code: def _CompareBackpropFilter(
      self,
      input_sizes,
      filter_sizes,
      output_sizes,
      stride,
      padding,
      data_format="NHWC",
  ):
      x0 = np.random.rand(*input_sizes).astype(np.float32)
      x2 = np.random.rand(*output_sizes).astype(np.float32)
  
      def _GetVal(use_xla):
          with self.session():
              t0 = array_ops.placeholder(np.float32, shape=input_sizes)
              t1 = constant_op.constant(
                  filter_sizes, shape=[len(filter_sizes)]
              )
              t2 = array_ops.placeholder(np.float32, shape=output_sizes)
              native_t0 = t0
              native_t2 = t2
              strides = [1, stride, stride, 1]
  
              if use_xla:
                  if data_format == "NCHW":
                      # Transpose from NWHC input to NCHW
                      # Ex. [4, 5, 5, 48] to [4, 48, 5, 5]
                      native_t0 = array_ops.transpose(t0, [0, 3, 1, 2])
                      native_t2 = array_ops.transpose(t2, [0, 3, 1, 2])
                      strides = [1, 1, stride, stride]
                  with self.test_scope():
                      backprop = nn_ops.depthwise_conv2d_native_backprop_filter(
                          native_t0,
                          t1,
                          native_t2,
                          strides=strides,
                          padding=padding,
                          data_format=data_format,
                      )
              else:
                  # For CPU, the format NCHW is not supported. Therefore we always use
                  # NHWC here.
                  backprop = (
                      nn_ops.depthwise_conv2d_native_backprop_filter(
                          native_t0,
                          t1,
                          native_t2,
                          strides=strides,
                          padding=padding,
                      )
                  )
              ret = backprop.eval({t0: x0, t2: x2})
              self.assertShapeEqual(ret, backprop)
              return ret
  
      gpu_value = _GetVal(use_xla=True)
      cpu_value = _GetVal(use_xla=False)
      self.assertAllClose(cpu_value, gpu_value, rtol=1e-4, atol=1e-4)
  
imports: import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import nn_impl
  from tensorflow.python.ops import nn_ops
  import tensorflow.python.ops.nn_grad
  from tensorflow.python.platform import test
label_desc: Use image node_id 11 for calling the DepthwiseConv2DTest obj's underlying member method code with example usage: obj._CompareBackpropFilter(input_sizes, filter_sizes, output_sizes, stride, padding, data_format) and returns: ret