【tensorflow】 tensor的默认name & operation 默认name

import tensorflow as tf
with tf.name_scope("name1"):
    with tf.variable_scope("var1"):
        w = tf.get_variable("q",shape=[2])
        scores_sigmoid = tf.nn.sigmoid(w)
g = tf.get_default_graph()
opts = g.get_operations()
print opts                  ##打印所有operation的name
print scores_sigmoid.name   ##打印的是scores_sigmoid这个tensor的name
对应的operation name:
[<tf.Operation 'var1/w/Initializer/random_uniform/shape' type=Const>, <tf.Operation 'var1/w/Initializer/random_uniform/min' type=Const>, <tf.Operation 'var1/w/Initializer/random_uniform/max' type=Const>, <tf.Operation 'var1/w/Initializer/random_uniform/RandomUniform' type=RandomUniform>, <tf.Operation 'var1/w/Initializer/random_uniform/sub' type=Sub>, <tf.Operation 'var1/w/Initializer/random_uniform/mul' type=Mul>, <tf.Operation 'var1/w/Initializer/random_uniform' type=Add>, <tf.Operation 'var1/w' type=VariableV2>, <tf.Operation 'var1/w/Assign' type=Assign>, <tf.Operation 'var1/w/read' type=Identity>, <tf.Operation 'name1/var1/Add/y' type=Const>, <tf.Operation 'name1/var1/Add' type=Add>, <tf.Operation 'var1/s/Initializer/random_uniform/shape' type=Const>, <tf.Operation 'var1/s/Initializer/random_uniform/min' type=Const>, <tf.Operation 'var1/s/Initializer/random_uniform/max' type=Const>, <tf.Operation 'var1/s/Initializer/random_uniform/RandomUniform' type=RandomUniform>, <tf.Operation 'var1/s/Initializer/random_uniform/sub' type=Sub>, <tf.Operation 'var1/s/Initializer/random_uniform/mul' type=Mul>, <tf.Operation 'var1/s/Initializer/random_uniform' type=Add>, <tf.Operation 'var1/s' type=VariableV2>, <tf.Operation 'var1/s/Assign' type=Assign>, <tf.Operation 'var1/s/read' type=Identity>, <tf.Operation 'name1_4/var1/Sigmoid' type=Sigmoid>, <tf.Operation 'var1/a/Initializer/random_uniform/shape' type=Const>, <tf.Operation 'var1/a/Initializer/random_uniform/min' type=Const>, <tf.Operation 'var1/a/Initializer/random_uniform/max' type=Const>, <tf.Operation 'var1/a/Initializer/random_uniform/RandomUniform' type=RandomUniform>, <tf.Operation 'var1/a/Initializer/random_uniform/sub' type=Sub>, <tf.Operation 'var1/a/Initializer/random_uniform/mul' type=Mul>, <tf.Operation 'var1/a/Initializer/random_uniform' type=Add>, <tf.Operation 'var1/a' type=VariableV2>, <tf.Operation 'var1/a/Assign' type=Assign>, <tf.Operation 'var1/a/read' type=Identity>, <tf.Operation 'name1_5/var1/Sigmoid' type=Sigmoid>, <tf.Operation 'var1/q/Initializer/random_uniform/shape' type=Const>, <tf.Operation 'var1/q/Initializer/random_uniform/min' type=Const>, <tf.Operation 'var1/q/Initializer/random_uniform/max' type=Const>, <tf.Operation 'var1/q/Initializer/random_uniform/RandomUniform' type=RandomUniform>, <tf.Operation 'var1/q/Initializer/random_uniform/sub' type=Sub>, <tf.Operation 'var1/q/Initializer/random_uniform/mul' type=Mul>, <tf.Operation 'var1/q/Initializer/random_uniform' type=Add>, <tf.Operation 'var1/q' type=VariableV2>, <tf.Operation 'var1/q/Assign' type=Assign>, <tf.Operation 'var1/q/read' type=Identity>, <tf.Operation 'name1_7/var1/Sigmoid' type=Sigmoid>]

对应的TensorFlow name:

name1_7/var1/Sigmoid:0


参与评论 您还未登录,请先 登录 后发表或查看评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:编程工作室 设计师:CSDN官方博客 返回首页

打赏作者

zwwhsxq

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值