already convert and get model.json and group1-shard1of1.bin but still get this error
Uncaught (in promise) Error: An InputLayer should be passed either a batchInputShape
or an inputShape
.
at new n (tfjs@latest:17:545265)
at value (tfjs@latest:17:404063)
at Vse (tfjs@latest:17:511819)
at rle (tfjs@latest:17:568666)
at value (tfjs@latest:17:643888)
at Vse (tfjs@latest:17:511819)
at rle (tfjs@latest:17:568666)
at tfjs@latest:17:634963
at h (tfjs@latest:17:2100)
at Generator. (tfjs@latest:17:3441)
Hi @ryorichie
Have you defined an InputLayer
in your model architecture? If yes, could you please provide the configuration of the InputLayer
, including batchInputShape
/ inputShape
?
Also, make sure that you are using correct the TensorFlow.js version.
model = tf.keras.models.Sequential([
tf.keras.layers.Dense(units=1, input_shape=[1])
])
model.compile(optimizer=‘sgd’, loss=‘mean_squared_error’)
xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)
ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype=float)
model.fit(xs, ys, epochs=500)
it’s c1w3 lab 3a file
The error shows that you’re encountering issues with TensorFlow.js, but the code provided appears to be written in Python not JavaScript!
Hello @ryorichie
Based on your error, it is the way you are trying to convert the model into json format is probably needs a review. There is a GitHub repo provided for this in the GitHub repo for this specialisation which is public, so you can have a look.
Another issue could be incompatibility between the autograder assignment and tf.version you are using and the python version in your local system.
When I had this issue, the below comment by James helped me resolve the issue
I am also sharing my post created thread when I had the issue, for you to understand what all issues I went through while passing this assignment.
Let me know if you need further help.
Regards
DP