Hi
I’m going to implement conditional instance normalization. what I planned to do is to pass the weight and bias for each sample as a second argument to the forward function as follows.
class ConditionalInstanceNorm(Module):
    
    __constants__ = ['num_groups', 'num_channels', 'eps', 'affine']
    num_groups: int
    num_channels: int
    eps: float
    affine: bool

    def __init__(self, num_channels: int, eps: float = 1e-5, affine: bool = True) -> None:
        super(ConditionalInstanceNorm, self).__init__()
        self.num_groups = num_channels
        self.num_channels = num_channels
        self.eps = eps
        self.affine = affine
        self.register_parameter('weight', None)
        self.register_parameter('bias', None)        

    def forward(self, input: Tensor, condition) -> Tensor:
        weight = condition[:, :, 0]
        bias = condition[:, :, 1]
        return F.group_norm(
            input, self.num_groups, weight, bias, self.eps)

    def extra_repr(self) -> str:
        return '{num_groups}, {num_channels}, eps={eps}, ' \
            'affine={affine}'.format(**self.__dict__)

here is my question:
whether weight. and bias calculated for each sample in a batch independently when as a condition I pass a tensor of [bs, num_channels] instead of [num_channels] or not. I tried to follow the source code until here 2 but can not understand it completely.