TypeError:as_default() missing 1 required positional argument: 'self'报错

报错部分代码:

with tf.Graph.as_default() as g:
    x = tf.placeholder(tf.float32, [None, mnist_inference.INPUT_NODE], name='x-input')
    y_ = tf.placeholder(tf.float32, [None, mnist_inference.OUTPUT_NODE], name='y-input')

原因:应该是with tf.Graph().as_default() as g:

Graph()是个函数。

猜你喜欢

转载自blog.csdn.net/sdfgtr/article/details/87687031