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","."]
docstr: The linear kernel (dot production).
  Args:
      t: output of conv theata
      p: output of conv phi
      g: output of conv g
      b: batch size
      c: channels number
      h: height of featuremaps
      w: width of featuremaps
docstr_tok: ["The","linear","kernel","(","dot","production",")",".","Args",":","t",":","output","of","conv","theata","p",":","output","of","conv","phi","g",":","output","of","conv","g","b",":","batch","size","c",":","channels","number","h",":","height","of","featuremaps","w",":","width","of","featuremaps"]
code: def kernel(self, t, p, g, b, c, h, w):
      """The linear kernel (dot production).
      Args:
          t: output of conv theata
          p: output of conv phi
          g: output of conv g
          b: batch size
          c: channels number
          h: height of featuremaps
          w: width of featuremaps
      """
      t = t.view(b, 1, c * h * w)
      p = p.view(b, 1, c * h * w)
      g = g.view(b, c * h * w, 1)
  
      att = torch.bmm(p, g)
  
      if self.use_scale:
          att = att.div((c * h * w) ** 0.5)
  
      x = torch.bmm(att, t)
      x = x.view(b, c, h, w)
  
      return x
  
imports: import torch.nn
  import torch
  import torch.nn.functional
  from torch.nn import BatchNorm2d
label_desc: Use image node_id 2 for calling the SpatialCGNL obj's underlying member method code with example usage: obj.kernel(t, p, g, b, c, h, w) and returns: x