(self, x: Tensor, alpha: float = 1e-8)
return y
forward pass of the layer
        Args:
            x: input activation volume
            alpha: small number for numerical stability
        Returns: y => x appended with standard deviation constant map
forward pass of the layer
        Args:
            x: input activation volume
            alpha: small number for numerical stability
        Returns: y => x appended with standard deviation constant map
forward pass of the layer Args : x : input activation volume alpha : small number for numerical stability Returns : y = > x appended with standard deviation constant map
def forward(self, x: Tensor, alpha: float = 1e-8) -> Tensor:
        """
        forward pass of the layer
        Args:
            x: input activation volume
            alpha: small number for numerical stability
        Returns: y => x appended with standard deviation constant map
        """
        batch_size, channels, height, width = x.shape
        if batch_size > self.group_size:
            assert batch_size % self.group_size == 0, (
                f"batch_size {batch_size} should be "
                f"perfectly divisible by group_size {self.group_size}"
            )
            group_size = self.group_size
        else:
            group_size = batch_size

        # reshape x into a more amenable sized tensor
        y = torch.reshape(x, [group_size, -1, channels, height, width])

        # indicated shapes are after performing the operation
        # [G x M x C x H x W] Subtract mean over groups
        y = y - y.mean(dim=0, keepdim=True)

        # [M x C x H x W] Calc standard deviation over the groups
        y = torch.sqrt(y.square().mean(dim=0, keepdim=False) + alpha)

        # [M x 1 x 1 x 1]  Take average over feature_maps and pixels.
        y = y.mean(dim=[1, 2, 3], keepdim=True)

        # [B x 1 x H x W]  Replicate over group and pixels
        y = y.repeat(group_size, 1, height, width)

        # [B x (C + 1) x H x W]  Append as new feature_map.
        y = torch.cat([x, y], 1)

        # return the computed values:
        return y
def forward ( self , x : Tensor , alpha : float = 1e-8 ) -> Tensor : batch_size , channels , height , width = x . shape if batch_size > self . group_size : assert batch_size % self . group_size == 0 , ( f"batch_size {batch_size} should be " f"perfectly divisible by group_size {self.group_size}" ) group_size = self . group_size else : group_size = batch_size # reshape x into a more amenable sized tensor y = torch . reshape ( x , [ group_size , - 1 , channels , height , width ] ) # indicated shapes are after performing the operation # [G x M x C x H x W] Subtract mean over groups y = y - y . mean ( dim = 0 , keepdim = True ) # [M x C x H x W] Calc standard deviation over the groups y = torch . sqrt ( y . square ( ) . mean ( dim = 0 , keepdim = False ) + alpha ) # [M x 1 x 1 x 1]  Take average over feature_maps and pixels. y = y . mean ( dim = [ 1 , 2 , 3 ] , keepdim = True ) # [B x 1 x H x W]  Replicate over group and pixels y = y . repeat ( group_size , 1 , height , width ) # [B x (C + 1) x H x W]  Append as new feature_map. y = torch . cat ( [ x , y ] , 1 ) # return the computed values: return y