code: def test_custom_rules(self):
      # Test some of the ops that are not covered by Metatensors
  
      # Note that unlike the Conv2d module, the function conv2d
      # does not take dtype/device arguments.
  
      def conv2d_fn(input, weight, bias):
          return torch.nn.functional.conv2d(input, weight, bias)
  
      def adaptive_avg_pool2d_fn(input, output_size: Tuple[int]):
          return torch._C._nn.adaptive_avg_pool2d(input, output_size)
  
      for fn, inputs_fn in (
          (conv2d_fn, sample_inputs_conv2d),
          (adaptive_avg_pool2d_fn, sample_inputs_adaptive_avg_pool2d),
      ):
          for dtype in (torch.int8, torch.float64):
              # Gets default version for conv2d
              sample_input: SampleInput = list(
                  inputs_fn(None, "cpu", dtype, False)
              )[-1]
              input_args = [sample_input.input, *sample_input.args]
              self.assert_dtype_equal_custom_args(fn, input_args)
  
imports: from itertools import product
  from typing import Tuple
  from unittest.case import expectedFailure
  import torch
  from torch import complex32, float32, float64, int32, int64
  from torch.jit._passes import _property_propagation
  from torch.testing._internal.common_methods_invocations import SampleInput, sample_inputs_adaptive_avg_pool2d, sample_inputs_conv2d
  from torch.testing._internal.common_utils import set_default_dtype, first_sample
  from torch.testing._internal.jit_utils import JitTestCase
  from torch.testing._internal.jit_metaprogramming_utils import create_traced_fn
  from torch.testing._internal.common_device_type import ops, instantiate_device_type_tests
  from torch.testing._internal.common_methods_invocations import op_db
label_desc: Use image node_id 4 for calling the TestDtypeAnalysis obj's underlying member method code with example usage: obj.test_custom_rules() and returns: torch, torch