jupyter notebook + tf2.0 报错记录: AttributeError: ‘Tensor‘ object has no attribute ‘numpy‘
2020-08-22 00:28
5125 查看
jupyter notebook + tf2.0 报错记录: AttributeError: 'Tensor' object has no attribute 'numpy'
问题描述
尝试显示tf中Tensor的值,采用 tesor_instance.nupmy() 实现,运行时报错
AttributeError: in converted code: <ipython-input-10-68deec28a095>:27 compute_loss * print(label.numpy()) AttributeError: 'Tensor' object has no attribute 'numpy'
解决方法
参考解决tf2 : AttributeError: ‘Tensor’ object has no attribute ‘numpy’
将涉及到 .numpy() 方法的所有函数顶层的
# @tf.function
注释掉
程序运行成功。
相关文章推荐
- 关于import tensorflow as tf的错误:AttributeError: type object 'NewBase' has no attribute 'is_abstract'
- TensorBoard tf.summary.merge_all() AttributeError: 'NoneType' object has no attribute 'bucket 错误
- Python 保存数组至.mat文件,报错:AttributeError: 'numpy.ndarray' object has no attribute 'items'
- tensorflow AttributeError: 'module' object has no attribute 'cpu_count'
- 【问题】Keras AttributeError: 'Tensor' object has no attribute '_keras_history'
- keras example--the solution to AttributeError: 'Tensor' object has no attribute '_keras_history'
- windows tensorflow AttributeError: 'NoneType' object has no attribute 'bucketize'
- 关于Tensorflow AttributeError: 'NoneType' object has no attribute 'keys'的问题
- AttributeError: 'Tensor' object has no attribute '_keras_history'
- AttributeError: Tensor object has no attribute _keras_history的解决方案
- No module named 'tensorflow.python.tools',AttributeError: 'module' object has no attribute 'copy'
- tensorflow AttributeError: 'module' object has no attribute 'cpu_count'
- Tensorflow protobuf版本报错问题解决(AttributeError: 'module' object has no attribute 'Default')
- 代码问题1:出现AttributeError: RefVariable object has no attribute numpy
- AttributeError: 'numpy.ndarray' object has no attribute 'value_counts'
- django学习记录-- 添加haystack搜索框架时报错:AttributeError: 'BlogIndex' object has no attribute 'fields'
- 跑faster rcnn测试时遇到错误Attribute Error: 'NoneType' object has no attribute 'astype'
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- TensorFlow1.0 运行报错 AttributeError: type object 'NewBase' has no attribute 'is_abstract'
- AttributeError: 'NoneType' object has no attribute 'sc' 解决方法!