tensorflow2.X 中tensor转为numpy

报错:

NotImplementedError: Cannot convert a symbolic Tensor (functional_1/conv_/truediv:0) to a numpy arra

解决方法:

import tensorflow as tf
 
Test = tf.Variable(10, dtype=tf.int32) 
 
with tf.compat.v1.Session() as sess:
    sess.run(tf.compat.v1.global_variables_initializer())
    nd_Test = sess.run(Test) 

参考链接:https://blog.csdn.net/baidu_34638825/article/details/109535412

你可能感兴趣的:(Python,tensorflow,python,人工智能)