code: def _check_potentials(self, edge, lengths=None):
      batch, N_1, M_1, x = edge.shape
      assert x == 3
      if self.local:
          assert (edge[..., 0] <= 0).all(), "skips must be negative"
          assert (edge[..., 1] >= 0).all(), "alignment must be positive"
          assert (edge[..., 2] <= 0).all(), "skips must be negative"
  
      edge = self.semiring.convert(edge)
  
      N = N_1
      M = M_1
  
      assert M >= N
  
      if lengths is None:
          lengths = torch.LongTensor([N] * batch).to(edge.device)
  
      assert max(lengths) <= N, "Length longer than edge scores"
      assert max(lengths) == N, "One length must be at least N"
      return edge, batch, N, M, lengths
  
file_path: pytorch-struct/torch_struct/alignment.py
imports: import torch
  from .helpers import _Struct
  import math
  from .semirings import LogSemiring
  from .semirings.fast_semirings import broadcast
label_desc: Use image node_id 2 for calling the Alignment obj's underlying member method code with example usage: obj._check_potentials(edge, lengths) and returns: edge,  batch,  N,  M,  lengths