class_docstr: Spatial CGNL block with dot production kernel for image classfication.
      
class_docstr_tok: ["Spatial","CGNL","block","with","dot","production","kernel","for","image","classfication","."]
code: def forward(self, x):
      residual = x
  
      t = self.t(x)
      p = self.p(x)
      g = self.g(x)
      b, c, h, w = t.size()
  
      if self.groups and self.groups > 1:
          _c = c // self.groups
  
          ts = torch.split(t, split_size_or_sections=_c, dim=1)
          ps = torch.split(p, split_size_or_sections=_c, dim=1)
          gs = torch.split(g, split_size_or_sections=_c, dim=1)
  
          _t_sequences = []
  
          for i in range(self.groups):
              _x = self.kernel(ts[i], ps[i], gs[i], b, _c, h, w)
              _t_sequences.append(_x)
  
          x = torch.cat(_t_sequences, dim=1)
      else:
          x = self.kernel(t, p, g, b, c, h, w)
  
      x = self.z(x)
      x = self.gn(x) + residual
  
      return x
  
imports: import torch.nn
  import torch
  import torch.nn.functional
  from torch.nn import BatchNorm2d
label_desc: Use image node_id 3 for calling the SpatialCGNL obj's underlying member method code with example usage: obj.forward(x) and returns: x