tensorflow/models · error · ValueError

Variable name {simple_name} is not supported on CustomLayerQ

Error message

Variable name {simple_name} is not supported on CustomLayerQuantize({self._original_layer_pattern}) transform.

What it means

Error "Variable name {simple_name} is not supported on CustomLayerQuantize({self._original_layer_pattern}) transform." thrown in tensorflow/models.

Source

Thrown at official/projects/qat/vision/n_bit/schemes.py:67

               num_bits_weight: int = 8,
               num_bits_activation: int = 8):
    super().__init__()
    self._original_layer_pattern = original_layer_pattern
    self._quantized_layer_class = quantized_layer_class
    self._num_bits_weight = num_bits_weight
    self._num_bits_activation = num_bits_activation

  def pattern(self) -> _LayerPattern:
    """See base class."""
    return _LayerPattern(self._original_layer_pattern)

  def _is_quantization_weight_name(self, name):
    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(f'Variable name {simple_name} is not supported on '
                     'CustomLayerQuantize({self._original_layer_pattern}) '
                     'transform.')

  def replacement(self, match_layer: _LayerNode) -> _LayerNode:
    """See base class."""
    bottleneck_layer = match_layer.layer
    bottleneck_config = bottleneck_layer['config']
    bottleneck_config['num_bits_weight'] = self._num_bits_weight
    bottleneck_config['num_bits_activation'] = self._num_bits_activation
    bottleneck_names_and_weights = list(match_layer.names_and_weights)
    quantized_layer = self._quantized_layer_class(
        **bottleneck_config)
    dummy_input_shape = [1, 1, 1, 1]
    quantized_layer.compute_output_shape(dummy_input_shape)
    quantized_names_and_weights = zip(
        [weight.name for weight in quantized_layer.weights],
        quantized_layer.get_weights())
    match_idx = 0

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/qat/vision/n_bit/schemes.py:67 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/8882add43e1517b5. Report an issue: GitHub.