Course 5, Week 1, Assignment 3, Exercise UNQ_C2 (=> Jazz, music_inference_model): Unexpected error message

Dear all,
when executing my solution, I am getting the below error message, which I cannot seem to make sense out of. Also I could not find any related existing topic. Please be so kind to advise.

Kind regards
Christian


WARNING:tensorflow:Functional inputs must come from tf.keras.Input (thus holding past layer metadata), they cannot be the output of a previous non-Input layer. Here, a tensor specified as input to “functional_2” was not an Input tensor, it was generated by layer repeat_vector_49.
Note that input tensors are instantiated via tensor = tf.keras.Input(shape).
The tensor that caused the issue was: repeat_vector_49/Tile:0
WARNING:tensorflow:Functional inputs must come from tf.keras.Input (thus holding past layer metadata), they cannot be the output of a previous non-Input layer. Here, a tensor specified as input to “functional_2” was not an Input tensor, it was generated by layer lstm.
Note that input tensors are instantiated via tensor = tf.keras.Input(shape).
The tensor that caused the issue was: lstm/PartitionedCall_79:0
WARNING:tensorflow:Functional inputs must come from tf.keras.Input (thus holding past layer metadata), they cannot be the output of a previous non-Input layer. Here, a tensor specified as input to “functional_2” was not an Input tensor, it was generated by layer lstm.
Note that input tensors are instantiated via tensor = tf.keras.Input(shape).
The tensor that caused the issue was: lstm/PartitionedCall_79:3

AssertionError Traceback (most recent call last)
in
----> 1 inference_model = music_inference_model(LSTM_cell, densor, Ty = 50)

in music_inference_model(LSTM_cell, densor, Ty)
56
57 # Step 3: Create model instance with the correct “inputs” and “outputs” (≈1 line)
—> 58 inference_model = Model(inputs=[x, a, c], outputs=outputs)
59
60 ### END CODE HERE ###

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py in new(cls, *args, **kwargs)
240 # Functional model
241 from tensorflow.python.keras.engine import functional # pylint: disable=g-import-not-at-top
→ 242 return functional.Functional(*args, **kwargs)
243 else:
244 return super(Model, cls).new(cls, *args, **kwargs)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
→ 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/functional.py in init(self, inputs, outputs, name, trainable)
113 # ‘arguments during initialization. Got an unexpected argument:’)
114 super(Functional, self).init(name=name, trainable=trainable)
→ 115 self._init_graph_network(inputs, outputs)
116
117 @trackable.no_automatic_dependency_tracking

/opt/conda/lib/python3.7/site-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
→ 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/functional.py in _init_graph_network(self, inputs, outputs)
182 # It’s supposed to be an input layer, so only one node
183 # and one tensor output.
→ 184 assert node_index == 0
185 assert tensor_index == 0
186 self._input_layers.append(layer)

AssertionError:

I found the problem in the meanwhile and was able to fix it.

Was the error in that line?

2 Likes

Yes, that correct. It should have been [x0, a0, c0] instead.

7 Likes

Thanks for confirming.

I agree. It should have been [x0, ac0, c0] instead of [x,a,c]…the reason being we need to send it the correct inputs prior to dropping Nones and one-hot encoding. The final x,a,c used in the original script are values after iterating through the time steps Ty. So it got to be wrong.

It’s interesting how the issue was not raised earlier and how people managed to get the tests passed and submit the assignment.

2 Likes

Hi, I have this same error and am currently unable to submit my assignment. How can I fix this? Do I need to edit some source?

Thanks!

Hi @phuecn ,

If there is error in your, then the error has to be amended before submitting your assignment in order for the grader to award any marks.
Do drop a post if further clarification is needed.