tensorflow 版本报错
TensorFlow报错:AttributeError: module 'tensorflow._api.v1.train' has no attribute 'SummaryWriter'等
TensorFlow报错:AttributeError: module ‘tensorflow._api.v1.train’ has no attribute 'SummaryWriter’等
分析:版本更新,方法调用方式改变
import tensorflow.compat.v1 as tf
tf.disable_eager_execution()
解决方式:
报错 | 原方法 | 更改后方法 |
---|---|---|
AttributeError: module ‘tensorflow._api.v1.train’ has no attribute ‘SummaryWriter’ | tf.train.SummaryWriter() | tf.summary.FileWriter() |
AttributeError: module ‘tensorflow’ has no attribute ‘merge_all_summaries’ | tf.merge_all_summaries() | tf.summary.merge_all() |
AttributeError: module ‘tensorflow’ has no attribute ‘histogram_summary’ | tf.histogram_summary() | tf.summary.histogram() |
AttributeError: module ‘tensorflow’ has no attribute ‘scalar_summary’ | tf.scalar_summary() | tf.summary.scalar() |
AttributeError: module ‘tensorflow’ has no attribute ‘image_summary’ | tf.image_summary() | tf.summary.image() |
AttributeError: module ‘tensorflow’ has no attribute 'audio_summary | tf.audio_summary() | tf.summary.audio() |
AttributeError: module ‘tensorflow’ has no attribute ‘merge_summary’ | tf.merge_summary() | tf.summary.merge() |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步