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]