code: def _x_dil_before_conv(x, dims, x_dilations, data_format):
      # adding dilation in input
      x_dilations = (
          [x_dilations] * dims
          if isinstance(x_dilations, int)
          else x_dilations
      )
      x_dilations_idxs = [
          i for i, x_dil in enumerate(x_dilations) if x_dil > 1
      ]
      if x_dilations_idxs:
          if data_format[-1] == "C":
              offset = 1
          else:
              offset = 2
          for i in x_dilations_idxs:
              h = x.shape[offset + i]
              new_height = h + (h - 1) * (x_dilations[i] - 1)
              h = tf.eye(new_height, dtype=x.dtype)[:: x_dilations[i]]
              x = tf.experimental.numpy.swapaxes(x, offset + i, -1)
              x = tf.matmul(x, h)
              x = tf.experimental.numpy.swapaxes(x, -1, offset + i)
      return x
  
imports: from typing import Optional, Tuple, Union, Sequence
  import tensorflow
  from tensorflow.python.types.core import Tensor
  import ivy
  from ivy.func_wrapper import with_supported_dtypes, with_unsupported_dtypes
  from .None import backend_version
  from ivy.functional.ivy.layers import _deconv_length, _get_x_data_format
label_desc: Use image node_id 2 for calling a global function with example usage: _x_dil_before_conv(x, dims, x_dilations, data_format) and returns: x