اذهب إلى المحتوى
  • 0

عرض محتويات الغراف Graph في تنسرفلو Tensorflow

عامر ابراهيم

السؤال

أحاول الحصول على بعض قيم ال Tensors من البيان من خلال model.get_layer_value(input, "tensorName")، وذلك من أجل دخل معين، لذلك أستخدم tensorboard لرسم الغراف والبحث عن ال tensorName. وسؤالي الآن هل هناك طريقة للتعرف على جميع ال tensors في الغراف دون استخدام tensorboard؟


 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 1

إليك كل ما قد تحتاجه من معلومات مع المثال التالي:

import tensorflow as tf
with tf.compat.v1.Session() as sess:
    hello = tf.constant('hello world')
    print(sess.run(hello))
#########################################
# للحصول على كل العقد    
[n for n in tf.compat.v1.get_default_graph().as_graph_def().node]
"""
[name: "Const"
 op: "Const"
 attr {
   key: "dtype"
   value {
     type: DT_STRING
   }
 }
 attr {
   key: "value"
   value {
     tensor {
       dtype: DT_STRING
       tensor_shape {
       }
       string_val: "hello world"
     }
   }
 }]
"""
# oprations للحصول على كل العمليات 
tf.compat.v1.get_default_graph().get_operations()
# [<tf.Operation 'Const' type=Const>]
# للحصول على كل المتغيرات
tf.compat.v1.global_variables()
#Tensors للحصول على كل ال 
[tensor for op in tf.compat.v1.get_default_graph().get_operations() for tensor in op.values()]
# [<tf.Tensor 'Const:0' shape=() dtype=string>]
# placeholders الحصول على ال 
[placeholder for op in tf.compat.v1.get_default_graph().get_operations() if op.type=='Placeholder' for placeholder in op.values()]

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...