عامر ابراهيم نشر 5 سبتمبر 2021 أرسل تقرير مشاركة نشر 5 سبتمبر 2021 (معدل) أريد طريقة لعرض مخطط الغراف، كيف يمكنني القيام بذلك؟ تم التعديل في 5 سبتمبر 2021 بواسطة عامر ابراهيم 1 اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
1 Ali Haidar Ahmad نشر 5 سبتمبر 2021 أرسل تقرير مشاركة نشر 5 سبتمبر 2021 يمكننا القيام بذلك من خلال التعليمة التالية: %tensorboard --logdir logs/train لكن يجب أولاً أن نقوم بتحميل الإضافة: %load_ext tensorboard.notebook أو في حال ظهر لديك الخطأ التالي: RuntimeError: Use '%load_ext tensorboard' instead of '%load_ext tensorboard.notebook'. قم باستخدام: %load_ext tensorboard.notebook مثال: %load_ext tensorboard.notebook import tensorflow as tf import numpy as np logdir = 'logs/' writer = tf.summary.create_file_writer(logdir) tf.summary.trace_on(graph=True, profiler=True) @tf.function def forward_and_backward(x, y, w, b, lr=tf.constant(0.01)): with tf.name_scope('logits'): logits = tf.matmul(x, w) + b with tf.name_scope('loss'): loss_fn = tf.nn.sparse_softmax_cross_entropy_with_logits( labels=y, logits=logits) reduced = tf.reduce_sum(loss_fn) with tf.name_scope('optimizer'): grads = tf.gradients(reduced, [w, b]) _ = [x.assign(x - g*lr) for g, x in zip(grads, [w, b])] return reduced # الدخل x = tf.convert_to_tensor(np.ones([1, 2]), dtype=tf.float32) y = tf.convert_to_tensor(np.array([1])) # params w = tf.Variable(tf.random.normal([2, 2]), dtype=tf.float32) b = tf.Variable(tf.zeros([1, 2]), dtype=tf.float32) loss_val = forward_and_backward(x, y, w, b) with writer.as_default(): tf.summary.trace_export( name='NN', step=0, profiler_outdir=logdir) %tensorboard --logdir logs/ الخرج: 1 اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
السؤال
عامر ابراهيم
أريد طريقة لعرض مخطط الغراف، كيف يمكنني القيام بذلك؟
تم التعديل في بواسطة عامر ابراهيمرابط هذا التعليق
شارك على الشبكات الإجتماعية
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.