tensorflow/models · error · ValueError

The block spec values

Error message

The block spec values {} do not match with the schema {}

What it means

Raised in mobiledet's block_spec_decoder when the first row of block_specs has a different number of fields than the block_spec_schema declares, meaning the spec rows cannot be interpreted as BlockSpec tuples. Fires when a hand-edited spec dict is inconsistent.

Solutions

  1. Make each block spec dict contain exactly the keys required by the schema shown in the error.
  2. Compare your custom block spec with the *_BLOCK_SPECS schema in mobiledet.py and add/remove keys to match.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/vision/modeling/backbones/mobiledet.py:327 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/d1fee0e7136737e7. Report an issue: GitHub.

Appendix: source

Thrown at official/vision/modeling/backbones/mobiledet.py:327

      be to set this value in (0, 1) to reduce the number of parameters or
      computation cost of the model.
    divisible_by: An `int` that ensures all inner dimensions are divisible by
      this number.

  Returns:
    A list of `BlockSpec` that defines structure of the base network.
  """

  spec_name = specs['spec_name']
  block_spec_schema = specs['block_spec_schema']
  block_specs = specs['block_specs']

  if not block_specs:
    raise ValueError(
        'The block spec cannot be empty for {} !'.format(spec_name))

  if len(block_specs[0]) != len(block_spec_schema):
    raise ValueError('The block spec values {} do not match with '
                     'the schema {}'.format(block_specs[0], block_spec_schema))

  decoded_specs = []

  for s in block_specs:
    kw_s = dict(zip(block_spec_schema, s))
    decoded_specs.append(BlockSpec(**kw_s))

  for ds in decoded_specs:
    if ds.filters:
      ds.filters = nn_layers.round_filters(filters=ds.filters,
                                           multiplier=filter_size_scale,
                                           divisor=divisible_by,
                                           round_down_protect=False,
                                           min_depth=8)

  return decoded_specs

View on GitHub (pinned to e006f5f0d5)