{"record":{"id":"8a047395701292ec","repo":"tensorflow/models","slug":"stridedtransformerencoderblock-does-not-support-o","errorCode":null,"errorMessage":"StridedTransformerEncoderBlock does not support `output_range` argument.","messagePattern":"StridedTransformerEncoderBlock does not support `output_range` argument\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/layers/pack_optimization.py","lineNumber":73,"sourceCode":"        packed_embeddings, input_mask, dtype=tf.bool)\n\n    combined_attention_mask = tf.cast(\n        tf.math.logical_and(attention_mask, packing_mask), tf.float32)\n\n    return dict(\n        packed_embeddings=packed_embeddings,\n        combined_attention_mask=combined_attention_mask)\n\n\n@tf_keras.utils.register_keras_serializable(package='Text')\nclass StridedTransformerEncoderBlock(\n    transformer_encoder_block.TransformerEncoderBlock):\n  \"\"\"Transformer layer for packing optimization to stride over inputs.\"\"\"\n\n  def __init__(self, *args, **kwargs):\n    super().__init__(*args, **kwargs)\n    if self._output_range is not None:\n      raise ValueError('StridedTransformerEncoderBlock does not '\n                       'support `output_range` argument.')\n    # TODO(b/337888023): Support block sparse attention with strided inputs.\n    if self._src_block_size is not None:\n      raise ValueError('StridedTransformerEncoderBlock does not '\n                       'support block sparse attention.')\n\n  def call(self, inputs, stride: tf.Tensor):\n    if isinstance(inputs, (list, tuple)):\n      if len(inputs) == 2:\n        input_tensor, attention_mask = inputs\n        key_value = None\n      elif len(inputs) == 3:\n        input_tensor, key_value, attention_mask = inputs\n      else:\n        raise ValueError('Unexpected inputs to %s with length at %d' %\n                         (self.__class__, len(inputs)))\n    else:\n      input_tensor, key_value, attention_mask = (inputs, None, None)","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/layers/pack_optimization.py#L55-L91","documentation":"Error \"StridedTransformerEncoderBlock does not support `output_range` argument.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/layers/pack_optimization.py:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}