Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get code on page 137 to work #54

Open
JeremyWhittaker opened this issue Sep 5, 2021 · 0 comments
Open

Can't get code on page 137 to work #54

JeremyWhittaker opened this issue Sep 5, 2021 · 0 comments

Comments

@JeremyWhittaker
Copy link

I'm trying to write the code from page 137 and I'm getting an error. I have no idea how to troubleshoot or perhaps it's just a simple typo. I've gone over the code multiple times and can't figure it out.

https://colab.research.google.com/drive/1CZXpt7xman0PL6lU9-HoL1oIphPHeADy?usp=sharing

Epoch 1/3
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-11-da7c14b3ed65> in <module>()
      1 if __name__ == "__main__":
----> 2   run(0)
      3   run(1)
      4   run(2)
      5   run(3)

10 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in wrapper(*args, **kwargs)
    992           except Exception as e:  # pylint:disable=broad-except
    993             if hasattr(e, "ag_error_metadata"):
--> 994               raise e.ag_error_metadata.to_exception(e)
    995             else:
    996               raise

ValueError: in user code:

    /usr/local/lib/python3.7/dist-packages/keras/engine/training.py:853 train_function  *
        return step_function(self, iterator)
    /usr/local/lib/python3.7/dist-packages/keras/engine/training.py:842 step_function  **
        outputs = model.distribute_strategy.run(run_step, args=(data,))
    /usr/local/lib/python3.7/dist-packages/tensorflow/python/distribute/distribute_lib.py:1286 run
        return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
    /usr/local/lib/python3.7/dist-packages/tensorflow/python/distribute/distribute_lib.py:2849 call_for_each_replica
        return self._call_for_each_replica(fn, args, kwargs)
    /usr/local/lib/python3.7/dist-packages/tensorflow/python/distribute/distribute_lib.py:3632 _call_for_each_replica
        return fn(*args, **kwargs)
    /usr/local/lib/python3.7/dist-packages/keras/engine/training.py:835 run_step  **
        outputs = model.train_step(data)
    /usr/local/lib/python3.7/dist-packages/keras/engine/training.py:787 train_step
        y_pred = self(x, training=True)
    /usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py:1020 __call__
        input_spec.assert_input_compatibility(self.input_spec, inputs, self.name)
    /usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py:202 assert_input_compatibility
        ' input tensors. Inputs received: ' + str(inputs))

    ValueError: Layer model_4 expects 1 input(s), but it received 23 input tensors. Inputs received: [<tf.Tensor 'ExpandDims:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_1:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_2:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_3:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_4:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_5:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_6:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_7:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_8:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_9:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_10:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_11:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_12:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_13:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_14:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_15:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_16:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_17:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_18:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_19:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_20:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_21:0' shape=(None, 1) dtype=int64>, <tf.Tensor 'ExpandDims_22:0' shape=(None, 1) dtype=int64>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant