复制代码
1
2
3weight = tf.get_variable("weight",shape=[5,5,1,32],initializer=tf.truncated_normal_initializer(stddev=stddev)) bias = tf.get_variable("bias",initializer=tf.constant(b_constant,shape=[b_shape]))
get_variable中,设置了shpae,那么initializer必须是数值,如果是张量,那么gei_variable中就不能设置shape,而是在张量中设置。
最后
以上就是正直绿草最近收集整理的关于tensorflow中定义变量赋值的注意事项的全部内容,更多相关tensorflow中定义变量赋值内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复