code: def pad_at_dim(t, pad, dim=-1, value=0.0):
      dims_from_right = (-dim - 1) if dim < 0 else (t.ndim - dim - 1)
      zeros = (0, 0) * dims_from_right
      return F.pad(t, (*zeros, *pad), value=value)
  
file_path: OpenNMT-py/onmt/modules/alibi_position_bias.py
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 1 for calling a global function with example usage: pad_at_dim(t, pad, dim, value) and returns: F