class_docstr: Represents structured linear-chain CRFs, generalizing HMMs smoothing, tagging models,
  and anything with chain-like dynamics.
code: def _check_potentials(self, edge, lengths=None):
      batch, N_1, C, C2 = self._get_dimension(edge)
      edge = self.semiring.convert(edge)
      N = N_1 + 1
  
      if lengths is None:
          lengths = torch.LongTensor([N] * batch).to(edge.device)
          # pass
      else:
          assert max(lengths) <= N, "Length longer than edge scores"
          assert max(lengths) == N, "One length must be at least N"
      assert C == C2, "Transition shape doesn't match"
      return edge, batch, N, C, lengths
  
file_path: pytorch-struct/torch_struct/linearchain.py
imports: import torch
  from .helpers import _Struct
label_desc: Use image node_id 1 for calling the LinearChain obj's underlying member method code with example usage: obj._check_potentials(edge, lengths) and returns: edge,  batch,  N,  C,  lengths