Improvise_a_Jazz_Solo_with_an_LSTM_Network_v4 C2

UNQ_C2:
I am unable to get 2C and 2D correctly. Any help is appreciated. Thanks!

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

ValueError 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)
63
64 # Step 3: Create model instance with the correct “inputs” and “outputs” (≈1 line)
—> 65 inference_model = Model(inputs=[x, a0, c0], outputs=out)
66
67

/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)
189 # Keep track of the network’s nodes and layers.
190 nodes, nodes_by_depth, layers, _ = _map_graph_network(
→ 191 self.inputs, self.outputs)
192 self._network_nodes = nodes
193 self._nodes_by_depth = nodes_by_depth

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/functional.py in _map_graph_network(inputs, outputs)
929 'The following previous layers ’
930 'were accessed without issue: ’ +
→ 931 str(layers_with_complete_input))
932 for x in nest.flatten(node.outputs):
933 computable_tensors.add(id(x))

ValueError: Graph disconnected: cannot obtain value for tensor Tensor(“input_2:0”, shape=(None, 1, 90), dtype=float32) at layer “lstm”. The following previous layers were accessed without issue:

I don’t see any evidence the problem is in steps 2.C or 2.D.

When you call the Model() be sure you’re using the correct variables. ‘x’ and ‘X’ are entirely different things.

The problem persists. Sorry, there is no ‘X’ in the function ‘music_inference_model()’.

I wonder if I am able to properly pass the arguments to the ‘tf.math.argmax’ line. I am passing axis = -1 along with variable out. Is this correct? Thanks!


after LSTM_cell: (None, 1, 90)
Tensor(“dense/Softmax_79:0”, shape=(None, 90), dtype=float32)
after argmax: (None,) , must be (None,)
after one_hot: (None, 90) , must be (None, 90)
after RepeatVector: (None, 1, 90)
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

ValueError 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)
68
69 # Step 3: Create model instance with the correct “inputs” and “outputs” (≈1 line)
—> 70 inference_model = Model(inputs=[x, a0, c0], outputs=out)
71
72

/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)
189 # Keep track of the network’s nodes and layers.
190 nodes, nodes_by_depth, layers, _ = _map_graph_network(
→ 191 self.inputs, self.outputs)
192 self._network_nodes = nodes
193 self._nodes_by_depth = nodes_by_depth

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/functional.py in _map_graph_network(inputs, outputs)
929 'The following previous layers ’
930 'were accessed without issue: ’ +
→ 931 str(layers_with_complete_input))
932 for x in nest.flatten(node.outputs):
933 computable_tensors.add(id(x))

ValueError: Graph disconnected: cannot obtain value for tensor Tensor(“input_2:0”, shape=(None, 1, 90), dtype=float32) at layer “lstm”. The following previous layers were accessed without issue: