tensorflow/models · error · NotImplementedError
Only 1-crop and 3-crop are supported. Found {num_crops!r}.
Error message
Only 1-crop and 3-crop are supported. Found {num_crops!r}. What it means
Error "Only 1-crop and 3-crop are supported. Found {num_crops!r}." thrown in tensorflow/models.
Source
Thrown at official/vision/ops/preprocess_ops_3d.py:307
false_fn=lambda: tf.broadcast_to([
0, 0, tf.cast(width, tf.float32) / 2 - target_width // 2, 0
], [4]))
offset_3 = tf.cond(
tf.greater_equal(height, width),
true_fn=lambda: tf.broadcast_to(
[0, tf.cast(height, tf.float32) - target_height, 0, 0], [4]),
false_fn=lambda: tf.broadcast_to(
[0, 0, tf.cast(width, tf.float32) - target_width, 0], [4]))
# pylint:disable=g-long-lambda
crops = []
for offset in [offset_1, offset_2, offset_3]:
offset = tf.cast(tf.math.round(offset), tf.int32)
crops.append(tf.slice(frames, offset, size))
frames = tf.concat(crops, axis=0)
else:
raise NotImplementedError(
f"Only 1-crop and 3-crop are supported. Found {num_crops!r}.")
return frames
def resize_smallest(frames: tf.Tensor, min_resize: int) -> tf.Tensor:
"""Resizes frames so that min(`height`, `width`) is equal to `min_resize`.
This function will not do anything if the min(`height`, `width`) is already
equal to `min_resize`. This allows to save compute time.
Args:
frames: A Tensor of dimension [timesteps, input_h, input_w, channels].
min_resize: Minimum size of the final image dimensions.
Returns:
A Tensor of shape [timesteps, output_h, output_w, channels] of type
frames.dtype where min(output_h, output_w) = min_resize.View on GitHub (pinned to e006f5f0d5)
Solutions
- Set num_crops to 1 or 3.
- Remove num_crops to use the default single-crop behavior.
When it happens
Trigger: Thrown at official/vision/ops/preprocess_ops_3d.py:307 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/e2a2e6e013427d9a.
Report an issue: GitHub.