(self, module)
Initialize the weights.
Initialize the weights.
Initialize the weights .
def _init_weights(self, module):
        """ Initialize the weights.
        """
        if isinstance(module, nn.Embedding):
            if module.weight.requires_grad:
                module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
        if isinstance(module, nn.Linear):
            module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
        elif isinstance(module, nn.LayerNorm):
            module.bias.data.zero_()
            module.weight.data.fill_(1.0)
        if isinstance(module, nn.Linear) and module.bias is not None:
            module.bias.data.zero_()
def _init_weights ( self , module ) : if isinstance ( module , nn . Embedding ) : if module . weight . requires_grad : module . weight . data . normal_ ( mean = 0.0 , std = self . config . initializer_range ) if isinstance ( module , nn . Linear ) : module . weight . data . normal_ ( mean = 0.0 , std = self . config . initializer_range ) elif isinstance ( module , nn . LayerNorm ) : module . bias . data . zero_ ( ) module . weight . data . fill_ ( 1.0 ) if isinstance ( module , nn . Linear ) and module . bias is not None : module . bias . data . zero_ ( )