错误如下图所示: 在代码中添加如下两行即可: config = tf.ConfigProto(allow_soft_placement = True) sess = tf.Session(config = config)