Hey there,
I have been stuck in this block for a long time and I check through all the similar threads but I still cannot find any bug in my codes, could anyone give me a hand? Really appreciate it.
Here’s the error message:
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_1" 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_19: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_1" 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_19:3
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-13-d6a140825d8e> in <module>
34
35
---> 36 modelf_test(modelf)
<ipython-input-13-d6a140825d8e> in modelf_test(target)
11
12
---> 13 model = target(Tx, Ty, n_a, n_s, len_human_vocab, len_machine_vocab)
14
15 print(summary(model))
<ipython-input-12-2101083d2371> in modelf(Tx, Ty, n_a, n_s, human_vocab_size, machine_vocab_size)
50
51 # Step 3: Create model instance taking three inputs and returning the list of outputs. (≈ 1 line)
---> 52 model = Model(inputs=[X,s,c], outputs=outputs)
53
54 ### 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: