class_docstr: A projective dependency CRF.
  
  Parameters:
      arc_scores_in: Arc scores of shape (B, N, N) or (B, N, N, L) with root scores on
      diagonal.
  
  Note: For single-root case, do not set cache=True for now.
class_docstr_tok: ["A","projective","dependency","CRF",".","Parameters",":","arc_scores_in",":","Arc","scores","of","shape","(","B",",","N",",","N",")","or","(","B",",","N",",","N",",","L",")","with","root","scores","on","diagonal",".","Note",":","For","single-root","case",",","do","not","set","cache=True","for","now","."]
docstr: Convert a arc representation to sequence
  
  Parameters:
      arcs : b x N x N arc indicators
  
  Returns:
      sequence : b x N long tensor in [0, N] (indexing is +1)
docstr_tok: ["Convert","a","arc","representation","to","sequence","Parameters",":","arcs",":","b","x","N","x","N","arc","indicators","Returns",":","sequence",":","b","x","N","long","tensor","in","[","0",",","N","]","(","indexing","is","+1",")"]
code: def from_parts(arcs):
      """
      Convert a arc representation to sequence
  
      Parameters:
          arcs : b x N x N arc indicators
  
      Returns:
          sequence : b x N long tensor in [0, N] (indexing is +1)
      """
      batch, N, _ = arcs.shape
      labels = torch.zeros(batch, N).long()
      on = arcs.nonzero()
      for i in range(on.shape[0]):
          if on[i][1] == on[i][2]:
              labels[on[i][0], on[i][2]] = 0
          else:
              labels[on[i][0], on[i][2]] = on[i][1] + 1
      return labels, None
  
file_path: pytorch-struct/torch_struct/deptree.py
imports: import torch
  from .helpers import _Struct, Chart
label_desc: Use image node_id 5 for calling the DepTree obj's underlying member method code with example usage: obj.from_parts(arcs) and returns: labels,  None