예제 #1
0
파일: nets.py 프로젝트: shashankg7/rectorch
    def init_weights(self, layer):
        r"""Initialize the weights of the network.

        Weights are initialized with the :py:func:`torch.nn.init.xavier_uniform_` initializer,
        while biases are initalized with the :py:func:`torch.nn.init.normal_` initializer.
        """
        if isinstance(layer, nn.Linear):
            xavier_init(layer.weight)
            normal_init(layer.bias)
예제 #2
0
파일: nets.py 프로젝트: shashankg7/rectorch
    def init_weights(self):
        r"""Initialize the weights of the network.

        Weights are initialized with the :py:func:`torch.nn.init.xavier_uniform_` initializer,
        while biases are initalized with the :py:func:`torch.nn.init.normal_` initializer.
        """
        xavier_init(self.enc_layer.weight)
        normal_init(self.enc_layer.bias)
        xavier_init(self.dec_layer.weight)
        normal_init(self.dec_layer.bias)