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

TF 2.4 raises a val err: Keras symbolic inputs/outputs do not impleme… #58

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

berserkr
Copy link

When running inside of tensorflow 2.4, I am getting the following error: TypeError: Keras symbolic inputs/outputs do not implement __len__. You may be trying to pass Keras symbolic inputs/outputs to a TF API that does not register dispatching, preventing Keras from automatically converting the API call to a lambda layer in the Functional Model. This error will also get raised if you try asserting a symbolic input/output directly.

This is due to the fact that utils.py checks for the length of the input tensors... the fix is to check if we have a single tensor instance, a tuple, or a list. Here we assume that we have a single tensor anyways and as far as I know there is no support for multiple outputs.

@mohanish3795
Copy link

Is this merged ?
I took the changes manually.
Thanks a lot for the fix. Helped a lot :) @berserkr

@MarvinKlemp
Copy link

MarvinKlemp commented Sep 7, 2021

Works for me 👍

Edit: Looks like TF > 2.x.x is not working at all.
Depending on the TF version I'm getting different errors. For example AvgPool2D and UpSampling2D not working in 2.4 while they work in 2.2 (but 2.2 has different issues)

@mchan133 mchan133 mentioned this pull request Dec 21, 2021
christian-steinmeyer added a commit to christian-steinmeyer/keras-surgeon that referenced this pull request Jul 6, 2023
christian-steinmeyer added a commit to christian-steinmeyer/keras-surgeon that referenced this pull request Jul 6, 2023
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

Successfully merging this pull request may close these issues.

3 participants