tensorflow/models · error · ValueError

Number of elements in temporal_kernel_sizes must equal to bl

Error message

Number of elements in temporal_kernel_sizes must equal to block_repeats.

What it means

Error "Number of elements in temporal_kernel_sizes must equal to block_repeats." thrown in tensorflow/models.

Source

Thrown at official/projects/const_cl/modeling/backbones/resnet_3d.py:260

        for each block in the current group.
      temporal_strides: An `int` of temporal strides for the first convolution
        in this group.
      spatial_strides: An `int` stride to use for the first convolution of the
        layer. If greater than 1, this layer will downsample the input.
      block_fn: Either `nn_blocks.ResidualBlock` or `nn_blocks.BottleneckBlock`.
      block_repeats: An `int` of number of blocks contained in the layer.
      stochastic_depth_drop_rate: A `float` of drop rate of the current block
        group.
      use_self_gating: A `bool` that specifies whether to apply self-gating
        module or not.
      name: A `str` name for the block.

    Returns:
      The output `tf.Tensor` of the block layer.
    """
    del inputs
    if len(temporal_kernel_sizes) != block_repeats:
      raise ValueError(
          'Number of elements in temporal_kernel_sizes must equal to '
          'block_repeats.')

    # Only apply self-gating module in the last block.
    use_self_gating_list = [False] * (block_repeats - 1) + [use_self_gating]

    name = 'cell'
    block_layers = {}
    block_layers[f'{name}_0'] = block_fn(
        filters=filters,
        temporal_kernel_size=temporal_kernel_sizes[0],
        temporal_strides=temporal_strides,
        spatial_strides=spatial_strides,
        stochastic_depth_drop_rate=stochastic_depth_drop_rate,
        use_self_gating=use_self_gating_list[0],
        se_ratio=self._se_ratio,
        kernel_initializer=self._kernel_initializer,
        kernel_regularizer=self._kernel_regularizer,

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/const_cl/modeling/backbones/resnet_3d.py:260 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/2e2bcc9c38f819bf. Report an issue: GitHub.