code: def _RunAndVerifyBackprop(
      self,
      input_sizes,
      filter_sizes,
      output_sizes,
      strides,
      dilations,
      padding,
      data_format,
      use_gpu,
      err,
      mode,
  ):
      total_input_size = 1
      total_filter_size = 1
      for s in input_sizes:
          total_input_size *= s
      for s in filter_sizes:
          total_filter_size *= s
      # Initializes the input tensor with array containing incrementing
      # numbers from 1.
      x1 = [f * 1.0 for f in range(1, total_input_size + 1)]
      x2 = [f * 1.0 for f in range(1, total_filter_size + 1)]
      default_dilations = (
          dilations[0] == 1 and dilations[1] == 1 and dilations[2] == 1
      )
  
      # If any dilation rate is larger than 1, only do test on the GPU
      # because we currently do not have a CPU implementation for arbitrary
      # dilation rates.
      if default_dilations or use_gpu:
          with self.cached_session(use_gpu=use_gpu) as sess:
              if data_format == "NCDHW":
                  input_sizes = test_util.NHWCToNCHW(input_sizes)
              t1 = constant_op.constant(x1, shape=input_sizes)
              t2 = constant_op.constant(x2, shape=filter_sizes)
              full_strides = [1] + strides + [1]
              full_dilations = [1] + dilations + [1]
              if data_format == "NCDHW":
                  full_strides = test_util.NHWCToNCHW(full_strides)
                  full_dilations = test_util.NHWCToNCHW(full_dilations)
              actual = nn_ops.conv3d(
                  t1,
                  t2,
                  strides=full_strides,
                  dilations=full_dilations,
                  padding=padding,
                  data_format=data_format,
              )
              expected = nn_ops.convolution(
                  t1,
                  t2,
                  padding=padding,
                  strides=strides,
                  dilation_rate=dilations,
                  data_format=data_format,
              )
              if data_format == "NCDHW":
                  actual = test_util.NCHWToNHWC(actual)
                  expected = test_util.NCHWToNHWC(expected)
              actual_grad = gradients_impl.gradients(
                  actual, t1 if mode == "input" else t2
              )[0]
              expected_grad = gradients_impl.gradients(
                  expected, t1 if mode == "input" else t2
              )[0]
              # "values" consists of two tensors for two backprops
              actual_value = self.evaluate(actual_grad)
              expected_value = self.evaluate(expected_grad)
              self.assertShapeEqual(actual_value, actual_grad)
              self.assertShapeEqual(expected_value, expected_grad)
          print("expected = ", expected_value)
          print("actual = ", actual_value)
          self.assertArrayNear(
              expected_value.flatten(), actual_value.flatten(), err
          )
  
imports: import math
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import nn_ops
  import tensorflow.python.ops.nn_grad
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util.compat import collections_abc
  from tensorflow.python.eager import context
label_desc: Use image node_id 42 for calling the Conv3DTest obj's underlying member method code with example usage: obj._RunAndVerifyBackprop(input_sizes, filter_sizes, output_sizes, strides, dilations, padding, data_format, use_gpu, err, mode) without return types