code: def _x_dil_before_conv(x, dims, x_dilations):
      # adding dilation to 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:
          for i in x_dilations_idxs:
              h = x.shape[2 + i]
              new_height = h + (h - 1) * (x_dilations[i] - 1)
              h = torch.eye(
                  new_height,
                  dtype=x.dtype,
                  device=ivy.as_native_dev(ivy.default_device()),
              )[:: x_dilations[i]]
              x = torch.swapaxes(x, 2 + i, -1)
              x = torch.matmul(x, h)
              x = torch.swapaxes(x, -1, 2 + i)
      return x
  
imports: from typing import Optional, Tuple, Union, Sequence
  import torch
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from .None import backend_version
  from ivy.functional.ivy.layers import _get_embed_dim, _handle_padding, _deconv_length
label_desc: Use image node_id 3 for calling a global function with example usage: _x_dil_before_conv(x, dims, x_dilations) and returns: x