Skip to content

Commit

Permalink
Fix CentreCrop compute_output_shape (#19382)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuryanarayanaY committed Mar 26, 2024
1 parent e74436b commit 2958e0a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions keras/layers/preprocessing/center_crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ def call(self, inputs):

def compute_output_shape(self, input_shape):
input_shape = list(input_shape)
if isinstance(input_shape[0], (list, tuple)) or len(
input_shape
) not in (3, 4):
raise ValueError(
"`input_shape` must be a non-nested tuple or list "
"of rank-1 with size 3 (unbatched) or 4 (batched). "
)
if len(input_shape) == 4:
if self.data_format == "channels_last":
input_shape[1] = self.height
Expand Down

0 comments on commit 2958e0a

Please sign in to comment.