使用tensorflow进行umapfit_transforminputs出现TypeError __array__ takes 1 positional argument but 2 were given inputseval转换为numpy数组时出现ValueError Cannot evaluate tensor using eval
这个错误可能是因为你正在使用TensorFlow 2.x版本,而不是1.x版本。在TensorFlow 2.x版本中,eval()方法已被删除,因此无法使用。
如果您使用的是TensorFlow 2.x版本,则可以使用以下方法将TensorFlow张量转换为NumPy数组:
-
使用numpy()方法将TensorFlow张量转换为NumPy数组,例如:inputs.numpy()。
-
使用numpy()方法将TensorFlow张量的值提取到NumPy数组中,例如:sess.run(inputs)。
如果您使用的是TensorFlow 1.x版本,则可以使用以下方法将TensorFlow张量转换为NumPy数组:
-
使用eval()方法将TensorFlow张量转换为NumPy数组,例如:inputs.eval()。
-
使用Session.run()方法将TensorFlow张量转换为NumPy数组,例如:sess.run(inputs)。
原文地址: https://www.cveoy.top/t/topic/bJmr 著作权归作者所有。请勿转载和采集!