Skip to content

Updated random_grayscale.py compute_output_spec #21312

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

Merged
merged 14 commits into from
May 21, 2025
Merged
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from keras.src import backend
from keras.src import tree
from keras.src.api_export import keras_export
from keras.src.layers.preprocessing.image_preprocessing.base_image_preprocessing_layer import ( # noqa: E501
BaseImagePreprocessingLayer,
Expand Down Expand Up @@ -96,7 +97,12 @@ def compute_output_shape(self, input_shape):
return input_shape

def compute_output_spec(self, inputs, **kwargs):
return inputs
return tree.map_structure(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should not be a tree.map_structure in this case, there is a single input tensor.

lambda x: backend.KerasTensor(
x.shape, dtype=x.dtype, sparse=x.sparse
),
inputs,
)

def transform_bounding_boxes(self, bounding_boxes, **kwargs):
return bounding_boxes
Expand Down