Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime Error in TensorFlow 2.4.1 #7

Open
michelebechini opened this issue May 11, 2021 · 3 comments
Open

Runtime Error in TensorFlow 2.4.1 #7

michelebechini opened this issue May 11, 2021 · 3 comments

Comments

@michelebechini
Copy link

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.

@ducha-aiki
Copy link
Owner

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.

@michelebechini
Copy link
Author

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.

@phrasenmaeher
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants