tf.constant(value,dtype=None,shape=None,name='Const')
创建一个常量tensor,先给出value,可以设定其shape
Constant 1-D Tensor populated with value list.
tensor = tf.constant([1, 2, 3, 4, 5, 6, 7]) => [1 2 3 4 5 6 7]
Constant 2-D tensor populated with scalar value -1.
tensor = tf.constant(-1.0, shape=[2, 3]) => [[-1. -1. -1.] [-1. -1. -1.]]
https://www.cnblogs.com/likethanlove/p/6227523.html
http://devdocs.io/tensorflow~python/tf/constant
网友评论