def METHOD_NAME(self, x):
    n, c, h, w = x.shape
    g_x = paddle.reshape(self.g(x), [n, self.inter_channels, -1])
    g_x = paddle.transpose(g_x, [0, 2, 1])
    if self.mode == 'gaussian':
        theta_x = paddle.reshape(x, [n, self.inter_channels, -1])
        theta_x = paddle.transpose(theta_x, [0, 2, 1])
        if self.sub_sample:
            phi_x = paddle.reshape(
                self.phi(x), [n, self.inter_channels, -1])
        else:
            phi_x = paddle.reshape(x, [n, self.in_channels, -1])
    elif self.mode == 'concatenation':
        theta_x = paddle.reshape(
            self.theta(x), [n, self.inter_channels, -1, 1])
        phi_x = paddle.reshape(self.phi(x), [n, self.inter_channels, 1, -1])
    else:
        theta_x = paddle.reshape(
            self.theta(x), [n, self.inter_channels, -1])
        theta_x = paddle.transpose(theta_x, [0, 2, 1])
        phi_x = paddle.reshape(self.phi(x), [n, self.inter_channels, -1])
    pairwise_func = getattr(self, self.mode)
    pairwise_weight = pairwise_func(theta_x, phi_x)
    y = paddle.matmul(pairwise_weight, g_x)
    y = paddle.transpose(y, [0, 2, 1])
    y = paddle.reshape(y, [n, self.inter_channels, h, w])
    output = x + self.conv_out(y)
    return output