code: def test_conv2d_backward_weight_infer_type():
      # From https://github.com/apache/tvm/pull/10439
      depthwise_conv_code = """
      fn (%input0: Tensor[(1, 3, 32, 32), float32], %v0_weight: Tensor[(3, 1, 3, 3), float32], %v0_bias: Tensor[(3), float32]) {
        %0 = nn.conv2d(%input0, %v0_weight, padding=[1, 1, 1, 1], groups=3, channels=3, kernel_size=[3, 3]);
        nn.bias_add(%0, %v0_bias)
      }
      """
  
      normal_conv_code = """
      fn (%input0: Tensor[(1, 3, 32, 32), float32], %v0_weight: Tensor[(3, 3, 3, 3), float32], %v0_bias: Tensor[(3), float32]) {
        %0 = nn.conv2d(%input0, %v0_weight, padding=[1, 1, 1, 1], groups=1, channels=3, kernel_size=[3, 3]);
        nn.bias_add(%0, %v0_bias)
      }
      """
  
      SEMVER = '#[version = "0.0.5"]\n'
  
      for code in [normal_conv_code, depthwise_conv_code]:
          expr = tvm.relay.parse_expr(SEMVER + code)
          fmod = tvm.IRModule.from_expr(expr)
  
          mod = relay.transform.InferType()(fmod)
          bwd_expr = relay.transform.gradient(
              mod["main"], mode="first_order"
          )
  
          bwd_mod = tvm.IRModule.from_expr(bwd_expr)
          bwd_mod = relay.transform.InferType()(bwd_mod)
  
imports: import numpy
  import pytest
  from tvm import topi
  import tvm.topi.testing
  import tvm
  from tvm import te
  from tvm import relay
  from tvm.relay.testing import check_grad, run_infer_type, run_opt_pass
  from tvm.relay.transform import gradient
  import tvm.testing
label_desc: Use image node_id 17 for calling a global function with example usage: test_conv2d_backward_weight_infer_type() without return types