LSUV-keras
LSUV-keras copied to clipboard
Runtime Error in TensorFlow 2.4.1
If I run your code, the following error arises:
RuntimeError: The layer has never been called and thus has no defined input.
It is due to model.get_input_at(0) in def get_activations(model, layer, X_batch):, but I can not manage how to fix it...
Thanks in advance.
Hi,
I am afraid that cannot help here :( this code was written in keras-theano times and I haven't written any tensorflow code since then. Probably it would be much simpler to re-implement everything from scratch.
Thank you for your quick reply. I reimplemented everything in TF 2.4.1, the only problem is how to run the first batch through the layer on which the LSUV is applied and get the activations.
I will try to solve this issue. Thanks again.
Hi, you can replace
intermediate_layer_model = Model(
inputs=model.get_input_at(0),
outputs=layer.get_output_at(0)
)
with
intermediate_layer_model = Model(
inputs=model.input,
outputs=layer.get_output_at(0)
)
and the initialization works as expected.