(self, t, p, g, b, c, h, w)
return x
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
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
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
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
def kernel ( self , t , p , g , b , c , h , w ) : 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