tensorflow/models · error · ValueError

Variable name {} is not supported.

Error message

Variable name {} is not supported.

What it means

Error "Variable name {} is not supported." thrown in tensorflow/models.

Source

Thrown at official/projects/qat/vision/quantization/helper.py:74

_ORIGINAL_WEIGHT_NAME = [
    'kernel',
    'depthwise_kernel',
    'pointwise_kernel',
    'gamma',
    'beta',
    'moving_mean',
    'moving_variance',
    'bias',
]


def is_quantization_weight_name(name: str) -> bool:
  simple_name = name.split('/')[-1].split(':')[0]
  if simple_name in _QUANTIZATION_WEIGHT_NAMES:
    return True
  if simple_name in _ORIGINAL_WEIGHT_NAME:
    return False
  raise ValueError('Variable name {} is not supported.'.format(simple_name))


def copy_original_weights(original_model: tf_keras.Model,
                          quantized_model: tf_keras.Model):
  """Helper function that copy the original model weights to quantized model."""
  original_weight_value = original_model.get_weights()
  weight_values = quantized_model.get_weights()

  original_idx = 0
  for idx, weight in enumerate(quantized_model.weights):
    if not is_quantization_weight_name(weight.name):
      if original_idx >= len(original_weight_value):
        raise ValueError('Not enought original model weights.')
      weight_values[idx] = original_weight_value[original_idx]
      original_idx = original_idx + 1

  if original_idx < len(original_weight_value):
    raise ValueError('Not enought quantized model weights.')

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/qat/vision/quantization/helper.py:74 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/0180d2ac362b9419. Report an issue: GitHub.