tensorflow AttributeError: '_UserObject' object has no attribute 'add_slot'
2022-04-01 15:14
1291 查看
环境:
python3.6 tensorflow2.6.0
使用 tf.saved_model.load 加载模型错误
AttributeError: '_UserObject' object has no attribute 'add_slot'
解决方案1:
升级到 tensorflow 2.7 以上
解决方案2:
import tensorflow as tf from tensorflow.keras import models #加此行即可解决, 或 from tensorflow.keras import Model
解决方案3:
使用 model.save_weights() 和 model.load_weights()
相关文章推荐
- No module named 'tensorflow.python.tools',AttributeError: 'module' object has no attribute 'copy'
- Tensorflow protobuf版本报错问题解决(AttributeError: 'module' object has no attribute 'Default')
- 关于import tensorflow as tf的错误:AttributeError: type object 'NewBase' has no attribute 'is_abstract'
- tensorflow AttributeError: 'module' object has no attribute 'cpu_count'
- 关于Tensorflow AttributeError: 'NoneType' object has no attribute 'keys'的问题
- windows tensorflow AttributeError: 'NoneType' object has no attribute 'bucketize'
- tensorflow AttributeError: 'module' object has no attribute 'cpu_count'
- PIL中分离通道发生“AttributeError: 'NoneType' object has no attribute 'bands'”
- python httplib2 - AttributeError: 'NoneType' object has no attribute 'makefile'
- pb2.text_format.Merge(f.read(), self.solver_param) AttributeError: 'module' object has no attribute 'text_format'
- yum--AttributeError: 'module' object has no attribute 'HTTPSHandler'
- AttributeError: 'NoneType' object has no attribute 'bytes' python3.4 win64
- httplib:AttributeError: 'module' object has no attribute 'HTTPConnection'
- AttributeError: module 'tensorflow.contrib.linalg' has no attribute 'LinearOperator'
- 解决:AttributeError: module ‘tensorflow.python.framework.ops‘ has no attribute ‘RegisterShape‘
- PIL中分离通道发生“AttributeError: 'NoneType' object has no attribute 'bands'”
- 【问题】Keras AttributeError: 'Tensor' object has no attribute '_keras_history'
- TRACE nova AttributeError: 'module' object has no attribute 'packs' 解决办法
- 转 Exception exceptions.AttributeError: "'NoneType' object has no attribute 'population'" 错误解决
- AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'seq2seq'