tf.constant
创建一个常数张量,传入list或者数值来填充
tensor = tf.constant([1, 2, 3, 4, 5, 6, 7])
with tf.Session() as sess:
print(sess.run(tensor))
---
[1 2 3 4 5 6 7]
a = tf.constant([1, 2, 3, 4, 5, 6], shape=[2, 3])
with tf.Session() as sess:
print(sess.run(a))
-----
[[1 2 3] [4 5 6]]
posted on 2019-05-07 10:43 happygril3 阅读(149) 评论(0) 收藏 举报
浙公网安备 33010602011771号