class_docstr: ISONet, a modified ResNet model.
class_docstr_tok: ["ISONet",",","a","modified","ResNet","model","."]
docstr: regularizes the convolution kernel to be (near) orthogonal during training.
  
  Args:
      m (nn.module]): [description]
docstr_tok: ["regularizes","the","convolution","kernel","to","be","(","near",")","orthogonal","during","training",".","Args",":","m","(","nn.module","]",")",":","[","description","]"]
code: def ortho_conv(self, m, device):
      """regularizes the convolution kernel to be (near) orthogonal during training.
  
      Args:
          m (nn.module]): [description]
      """
      operator = m.weight
      operand = torch.cat(torch.chunk(m.weight, m.groups, dim=0), dim=1)
      transposed = m.weight.shape[1] < m.weight.shape[0]
      num_channels = (
          m.weight.shape[1] if transposed else m.weight.shape[0]
      )
      if transposed:
          operand = operand.transpose(1, 0)
          operator = operator.transpose(1, 0)
      gram = F.conv2d(
          operand,
          operator,
          padding=(m.kernel_size[0] - 1, m.kernel_size[1] - 1),
          stride=m.stride,
          groups=m.groups,
      )
      identity = torch.zeros(gram.shape).to(device)
      identity[
          :, :, identity.shape[2] // 2, identity.shape[3] // 2
      ] = torch.eye(num_channels).repeat(1, m.groups)
      out = torch.sum((gram - identity) ** 2.0) / 2.0
      return out
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 6 for calling the ISONet obj's underlying member method code with example usage: obj.ortho_conv(m, device) and returns: out