I run this code:
LSTM_cell = LSTM(n_a, return_state = True)
inference_model = music_inference_model(LSTM_cell, densor, Ty = 50)
here are my x.shape before the error:
after argmax: Tensor(“ArgMax_212:0”, shape=(None,), dtype=int64)
after one_hot: Tensor(“OneHot_211:0”, shape=(None, 90), dtype=float32)
after RepeatVector: (None, 1, 90)
and then some warnings:
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_8” was not an Input tensor, it was generated by layer repeat_vector_249.
Note that input tensors are instantiated viatensor = tf.keras.Input(shape)
.
The tensor that caused the issue was: repeat_vector_249/Tile:0
WARNING:tensorflow:Functional inputs must come fromtf.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_8” was not an Input tensor, it was generated by layer lstm_61.
Note that input tensors are instantiated viatensor = tf.keras.Input(shape)
.
The tensor that caused the issue was: lstm_61/PartitionedCall_49:0
WARNING:tensorflow:Functional inputs must come fromtf.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_8” was not an Input tensor, it was generated by layer lstm_61.
Note that input tensors are instantiated viatensor = tf.keras.Input(shape)
.
The tensor that caused the issue was: lstm_61/PartitionedCall_49:3
then i had this error:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-30-c55ce93f25e1> in <module>
1 LSTM_cell = LSTM(n_a, return_state = True)
----> 2 inference_model = music_inference_model(LSTM_cell, densor, Ty = 50)
<ipython-input-29-1f6385a6058a> in music_inference_model(LSTM_cell, densor, Ty)
66 print(f"\tx: {x.shape}")
67 print("\t", len(outputs))
---> 68 inference_model = Model(inputs=[x, a, c], outputs=outputs)
69
70 ### 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:
please tell me why. ths