code: def test_params_type_filtering(self):
      shape_tensor5 = (1, 2, 2, 3, 2)
      size_tensor5 = (
          shape_tensor5[0]
          * shape_tensor5[1]
          * shape_tensor5[2]
          * shape_tensor5[3]
          * shape_tensor5[4]
      )
      random_tensor = np.random.normal(size=size_tensor5).reshape(
          shape_tensor5
      )
  
      w = ParamsType(
          a1=TensorType("int32", shape=(None, None)),
          a2=TensorType(
              "float64", shape=(None, None, None, None, None)
          ),
          a3=Generic(),
      )
  
      # With a value that does not match the params type.
      o = Params(
          w,
          a1=np.asarray(
              [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]
          ).astype("int64"),
          a2=random_tensor.astype("float32"),
          a3=2000,
      )
      # should fail (o.a1 is not int32, o.a2 is not float64)
      with pytest.raises(TypeError):
          w.filter(o, True)
      # should fail (o.a1 is not int32, o.a2 is not float64, and downcast is disallowed)
      with pytest.raises(TypeError):
          w.filter(o, False, False)
      # Should pass.
      w.filter(o, strict=False, allow_downcast=True)
  
      # With a value that matches the params type.
      o1 = Params(
          w,
          a1=np.asarray(
              [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]
          ).astype("int32"),
          a2=random_tensor.astype("float64"),
          a3=2000,
      )
      # All should pass.
      w.filter(o1, strict=True)
      w.filter(o1, strict=False, allow_downcast=False)
      w.filter(o1, strict=False, allow_downcast=True)
  
      # Check values_eq and values_eq_approx.
      o2 = Params(
          w,
          a1=np.asarray(
              [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]
          ).astype("int32"),
          a2=random_tensor.astype("float64"),
          a3=2000,
      )
      assert w.values_eq(o1, o2)
      assert w.values_eq_approx(o1, o2)
  
      # Check value_eq_approx.
      # NB: I don't know exactly which kind of differences is rejected by values_eq but accepted by values_eq_approx.
      # So, I just play a little with float values.
      o3 = Params(
          w,
          a1=np.asarray(
              [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]
          ).astype("int32"),
          a2=(
              random_tensor.astype("float32")
              * 10
              / 2.2
              * 2.19999999999
              / 10
          ).astype("float64"),
          a3=2000.0 - 0.00000000000000001,
      )
      assert w.values_eq_approx(o1, o3)
  
imports: import numpy
  import pytest
  import pytensor
  from pytensor import tensor
  from pytensor.graph.basic import Apply
  from pytensor.link.c.op import COp, ExternalCOp
  from pytensor.link.c.params_type import Params, ParamsType
  from pytensor.link.c.type import EnumList, Generic
  from pytensor.scalar import ScalarType
  from pytensor.tensor.type import TensorType, matrix
  from tests import unittest_tools
label_desc: Use image node_id 3 for calling the TestParamsType obj's underlying member method code with example usage: obj.test_params_type_filtering() without return types