https://github.com/tensorflow/tensorflow/issues/45288
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-8326baccad65> in <module>()
1 # Restart the runtime, then run
2 import tensorflow as tf
----> 3 model = tf.keras.models.load_model('hidden_net')
9 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/functional.py in reconstruct_from_config(config, custom_objects, created_layers)
1234 layer = created_layers[layer_name]
1235 node_index = get_node_index(layer, node_index)
-> 1236 layer_output_tensors = layer._inbound_nodes[node_index].output_tensors
1237 output_tensors.append(nest.flatten(layer_output_tensors)[tensor_index])
1238
TypeError: list indices must be integers or slices, not NoneType
Due to missing input shape at the front of Sequential layer.
So we need to fix the model by explcitly specifying input_shape
.
But there seems to a workaround like the below.
tf.compat.v1.disable_eager_execution()
It allows to load the model which occurs in TypeError.