报错提示:

cifar10_train.py : AttributeError: module 'tensorflow._api.v1.train' has no attribute 'SummaryWriter'

报错原因:Tensorflow版本冲突,SummaryWriter方法已经改名

解决方案:执行如下修改

# 报错代码
summary_writer = tf.train.SummaryWriter(FLAGS.train_dir, graph_def=sess.graph_def)
    
# 改正代码
summary_writer = tf.summary.FileWriter(FLAGS.train_dir, graph_def=sess.graph_def)