-
Notifications
You must be signed in to change notification settings - Fork 19.4k
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
keras.ops.map can't handle nested structures for TensorFlow backend #20048
Labels
Comments
Hi @apage224 - Thanks for raising this issue. We have raised an internal fix for this issue. Soon it will be reflected in the documentation as well. This fix is working fine for nested structure(i.e dict,list,tuple). Example:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Keras: 3.4.1
TensorFlow: 2.17.0
As background, I am looking to leverage both
keras.ops.map
as well askeras.ops.vectorize_map
for custom preprocessing layers. Certain layers require sequential mapping hence I usekeras.ops.map
. If I pass a nested input,keras.ops.map
will fail when using TensorFlow backend.I believe this line is an issue as it assumes the input is not nested:
From what I can tell, it is trying to determine the output signature (which might not match the input) by feeding the function a single element (e.g.
xs[0]
) which won't work on nested inputs. I was able to fix it by updating the function as follows (note: I've done only limited testing).Test case:
Calling
keras.ops.map
:produces error:
Calling custom
map
:produces correct result:
The text was updated successfully, but these errors were encountered: