class_docstr: Base test class for StableHLO quant tests.
class_docstr_tok: ["Base","test","class","for","StableHLO","quant","tests","."]
code: def _create_einsum_model(
      self,
      saved_model_path: str,
      equation: str,
      y_shape: Sequence[int],
      x_signature: Sequence[Optional[int]],
      y_signature: Sequence[Optional[int]],
      bias_shape: Optional[Sequence[int]] = None,
  ) -> module.Module:
      class EinsumModel(module.Module):
          """Einsum class."""
  
          def __init__(self):
              self._bias = None
              if bias_shape is not None:
                  self._bias = array_ops.constant(
                      np.random.uniform(size=bias_shape),
                      dtype=dtypes.float32,
                  )
  
              self._kernel = np.random.uniform(size=y_shape).astype(
                  "f4"
              )
              self._min = (-0.8, -0.8, -0.9)
              self._max = (0.9, 0.9, 1.0)
  
          @def_function.function(
              input_signature=[
                  tensor_spec.TensorSpec(
                      name="x", shape=x_signature, dtype=dtypes.float32
                  )
              ]
          )
          def einsum_with_kernel(
              self, x: core.Tensor
          ) -> Mapping[str, core.Tensor]:
              return self._einsum(x, self._kernel)
  
          @def_function.function(
              input_signature=[
                  tensor_spec.TensorSpec(
                      name="x", shape=x_signature, dtype=dtypes.float32
                  ),
                  tensor_spec.TensorSpec(
                      name="y", shape=y_signature, dtype=dtypes.float32
                  ),
              ]
          )
          def einsum_without_kernel(
              self, x: core.Tensor, y: core.Tensor
          ) -> Mapping[str, core.Tensor]:
              return self._einsum(x, y)
  
          def _einsum(self, x, y):
              out = tensorflow.einsum(equation, x, y)
              if self._bias is not None:
                  out = nn_ops.bias_add(out, self._bias)
              return {"output": out}
  
      model = EinsumModel()
      signatures = {
          "serving_default": model.einsum_with_kernel.get_concrete_function(
              tensor_spec.TensorSpec(
                  name="x", shape=x_signature, dtype=dtypes.float32
              )
          ),
      }
      saved_model_save.save(
          model, saved_model_path, signatures=signatures
      )
      return model
  
imports: from typing import Mapping, Sequence, Optional, Tuple, List
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.module import module
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
  from tensorflow.python.saved_model import save
  from tensorflow.python.types import core
label_desc: Use image node_id 6 for calling the QuantizedModelTest obj's underlying member method code with example usage: obj._create_einsum_model(saved_model_path, equation, y_shape, x_signature, y_signature, bias_shape) and returns: model, self, self, dict