code: def _pad_channels_dim(tensor, size):
      channels_dim = tensor.shape.dims[-1]
      if channels_dim.size > size:
          raise ValueError(
              "Cannot pad to size of {} when the original size "
              "of {} is bigger".format(size, channels_dim.size)
          )
      elif channels_dim.size == size:
          return tensor
      else:
          return mtf.pad(
              tensor, [0, size - channels_dim.size], channels_dim.name
          )
  
imports: import gin
  import mesh_tensorflow
  from mesh_tensorflow.transformer import transformer
  from mesh_tensorflow.transformer import transformer_layers
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: _pad_channels_dim(tensor, size) and returns: tensor, mtf