TensorFlow UMAP.fit_transform() 错误:TypeError 和 ValueError 解决方法
这个错误可能是因为你正在使用 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/jr6b 著作权归作者所有。请勿转载和采集!