code: def _ComputeReferenceDilatedConv(
      self,
      tensor_in_sizes,
      filter_in_sizes,
      stride,
      dilation,
      padding,
      data_format,
      use_gpu,
      op_name,
  ):
      total_size_tensor = np.prod(tensor_in_sizes)
      total_size_filter = np.prod(filter_in_sizes)
  
      # Initializes the input tensor with array containing incrementing
      # numbers from 1.
      x1 = [f * 1.0 for f in range(1, total_size_tensor + 1)]
      x2 = [f * 1.0 for f in range(1, total_size_filter + 1)]
      with self.cached_session(use_gpu=use_gpu):
          t1 = constant_op.constant(x1, shape=tensor_in_sizes)
          t2 = constant_op.constant(x2, shape=filter_in_sizes)
          if isinstance(stride, collections_abc.Iterable):
              strides = list(stride)
          else:
              strides = [stride, stride, stride]
          if data_format == "NCDHW":
              t1 = test_util.NHWCToNCHW(t1)
              full_strides = [1, 1] + strides
              full_dilation = [1, 1] + dilation
          else:
              full_strides = [1] + strides + [1]
              full_dilation = [1] + dilation + [1]
          expected = nn_ops.convolution(
              t1,
              t2,
              padding=padding,
              strides=strides,
              dilation_rate=dilation,
              data_format=data_format,
          )
          if op_name == "Conv3D":
              op = nn_ops.conv3d
              conv_format = data_format
          elif op_name == "Conv":
              op = gen_nn_ops.conv
              conv_format = (
                  "CHANNELS_LAST"
                  if data_format == "NDHWC"
                  else "CHANNELS_FIRST"
              )
          else:
              raise ValueError("Invalid op name: %s" % op_name)
  
          computed = op(
              t1,
              t2,
              strides=full_strides,
              dilations=full_dilation,
              padding=padding,
              data_format=conv_format,
          )
          if data_format == "NCDHW":
              expected = test_util.NCHWToNHWC(expected)
              computed = test_util.NCHWToNHWC(computed)
      return expected, computed
  
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 3 for calling the Conv3DTest obj's underlying member method code with example usage: obj._ComputeReferenceDilatedConv(tensor_in_sizes, filter_in_sizes, stride, dilation, padding, data_format, use_gpu, op_name) and returns: expected,  computed