Models: TypeError: __init__() missing 2 required positional arguments: 'inputs' and ‘outputs'

Created on 28 Feb 2018  Â·  11Comments  Â·  Source: tensorflow/models

I want to review the code of tensorflow/models/official/mnist/mnist.py in the Python 3.5.2. But while I was running the code in the Spyder of Anaconde, a mistake, which is typeError: __init__() missing 2 required positional arguments: 'inputs' and ‘outputs' ,occurred.Why?
default
That is error which python console hints.
Please give me a favor.

Most helpful comment

The code in the master branch of this repository may not be compatible with TensorFlow 1.5.
To get the version of code compatible with TensorFlow 1.5, please use the r1.5 branch of the models repository.

Does that work?

(FYI @karmel )

All 11 comments

Facing same error. I tried tensorflow 1.5 and 1.6 (Both CPU and GPU version as well as Python 2.7 and Python 3.5.2)

Following the tutorial models/official/mnist/mnist.py, I meet the same error (python3.5 tensorflow-gpu 1.6), the super class tf.keras.Model needs arguments inputs and outputs.

The code in the master branch of this repository may not be compatible with TensorFlow 1.5.
To get the version of code compatible with TensorFlow 1.5, please use the r1.5 branch of the models repository.

Does that work?

(FYI @karmel )

It did work, thanks!

Same issue above when running mnist_eager.py with tensorflow 1.6 cpu.

Unfortunately, the suggestion to use r1.5 branch does not help, since mnist_eager.py is not available in r1.5.

As mentioned earlier, to get a version of the models compatible with a particular version of TensorFlow, please switch to the corresponding branch.

That said, the eager example moved from the tensorflow/tensorflow repository to this tensorflow/models repository after the 1.6 release branch is cut. Sorry for the trouble, this will be alleviated with future releases.

That said, you can find a version of the MNIST example compatible with eager execution in the appropriate branch of the tensorflow repository. See:

Alternatively, the nightly build of TensorFlow will be compatible with the master branch of this repository.

Hope that helps!

Checking out the r1.5 branch suited my version of Tensorflow.
git checkout r1.5

Closing since this seems to be addressed by checking out the appropriate branch of the models repository. Please feel free to reopen if I'm mistaken.

Facing same error.
I change tensorflow to 1.7 and it work ok ! (I face the same error when my tf is 1.8。)
The error accur beacause the API only availible when tf is 1.7 or 1.6,so , when chenge tf to 1.7,it work well.

Facing same error.
I change tensorflow to 1.7 and it work ok ! (I face the same error when my tf is 1.8。)
The error accur beacause the API only availible when tf is 1.7 or 1.6,so , when chenge tf to 1.7,it work well.

Facing same error.
But my tf is 1.7.0, it doesn't work.

Can anyone help me, please? I have this error, but I don't know where am I supposed to add the width and height (I'm a beginner);

ax.add_patch(
mpatches.Rectangle(
(caja.x, caja.y), # (x,y)
w = (caja.width), # width
h = (h), # height
facecolor="#00ffff",
edgecolor="black",
linewidth=3)

Error:__init__() missing 2 required positional arguments: 'width' and 'height'

Was this page helpful?
0 / 5 - 0 ratings