class_docstr: Starting from IOS17 the alpha/beta can have different dtypes from the input/output, so this
  test class is mainly to verify the behaviour of those alpha/beta related activations.
class_docstr_tok: ["Starting","from","IOS17","the","alpha\/beta","can","have","different","dtypes","from","the","input\/output",",","so","this","test","class","is","mainly","to","verify","the","behaviour","of","those","alpha\/beta","related","activations","."]
code: def test_builder_to_backend_numerical_alpha_beta(
      self, compute_unit, backend, different_dtype, op_name
  ):
      x = np.array([[[-1, 2, -3], [4, -5, 6]]], dtype=np.float32)
      alpha = np.float16(2.0) if different_dtype else np.float32(2.0)
      beta = np.float16(1.0) if different_dtype else np.float32(1.0)
      if op_name == "softplus_parametric":
          alpha = np.array([2.0, 2.0], dtype=alpha.dtype)
          beta = np.array([1.0, 1.0], dtype=beta.dtype)
  
      def calculate_by_np():
          if op_name == "clamped_relu":
              return np.minimum(np.maximum(x, 0), beta) + np.minimum(
                  np.minimum(x, 0) * alpha, beta
              )
          elif op_name == "linear_activation":
              return x * alpha + beta
          elif op_name == "scaled_tanh":
              return alpha * np.tanh(x * beta)
          elif op_name == "sigmoid_hard":
              return np.minimum(np.maximum((alpha * x) + beta, 0), 1)
          elif op_name == "softplus_parametric":
              alpha_br = alpha
              beta_br = beta
              for i in range(len(x.shape)):
                  if i != 1:
                      alpha_br = np.expand_dims(alpha_br, i)
                      beta_br = np.expand_dims(beta_br, i)
              res = alpha_br * np.log(np.exp(x * beta_br) + 1)
              return res
          else:
              raise ValueError(f"Invalid op_name: {op_name}")
  
      def build(x):
          return getattr(mb, op_name)(x=x, alpha=alpha, beta=beta)
  
      run_compare_builder(
          build,
          input_placeholders={"x": mb.placeholder(shape=x.shape)},
          input_values={"x": x},
          expected_output_types=x.shape + (types.fp32,),
          expected_outputs=calculate_by_np(),
          compute_unit=compute_unit,
          backend=backend,
      )
  
file_path: coremltools/coremltools/converters/mil/mil/ops/tests/iOS17/test_activation.py
imports: import itertools
  import numpy
  import pytest
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.ops.tests.iOS17 import backends
  from coremltools.converters.mil.mil.ops.tests.testing_utils import run_compare_builder
  from coremltools.converters.mil.testing_reqs import compute_units
label_desc: Use image node_id 4 for calling the TestInputWeightDifferentDtypes obj's underlying member method code with example usage: obj.test_builder_to_backend_numerical_alpha_beta(compute_unit, backend, different_dtype, op_name) and returns: getattr, unknown, unknown, unknown, np, res