fantomas 发表于 2018-10-13 17:25:51

How can I convert a tensor into a numpy array in TensorFlow?

Session.run或eval返回的任何张量都是NumPy数组。
print(type(tf.Session().run(tf.constant())))
<class 'numpy.ndarray'>or:
sess = tf.Session()
with sess.as_default():
print(type(tf.constant().eval()))
<class 'numpy.ndarray'>

页: [1]
查看完整版本: How can I convert a tensor into a numpy array in TensorFlow?