code: def _off_diagonal(x):
      # return a flattened view of the off-diagonal elements of a square matrix
      n, m = x.shape
      assert n == m
      return x.flatten()[:-1].view(n - 1, n + 1)[:, 1:].flatten()
  
file_path: lightly/lightly/loss/barlow_twins_loss.py
imports: from typing import Tuple
  import torch
  import torch.distributed
  import torch.nn.functional
label_desc: Use image node_id 2 for calling a global function with example usage: _off_diagonal(x) and returns: x