Python torch.nn.init.kaiming_uniform_() Examples

The following are 30 code examples of torch.nn.init.kaiming_uniform_(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module torch.nn.init , or try the search function .
Example #1
Source File: utils.py    From prediction-flow with MIT License 6 votes vote down vote up
def init_weights(model):
    if isinstance(model, nn.Linear):
        if model.weight is not None:
            init.kaiming_uniform_(model.weight.data)
        if model.bias is not None:
            init.normal_(model.bias.data)
    elif isinstance(model, nn.BatchNorm1d):
        if model.weight is not None:
            init.normal_(model.weight.data, mean=1, std=0.02)
        if model.bias is not None:
            init.constant_(model.bias.data, 0)
    elif isinstance(model, nn.BatchNorm2d):
        if model.weight is not None:
            init.normal_(model.weight.data, mean=1, std=0.02)
        if model.bias is not None:
            init.constant_(model.bias.data, 0)
    elif isinstance(model, nn.BatchNorm3d):
        if model.weight is not None:
            init.normal_(model.weight.data, mean=1, std=0.02)
        if model.bias is not None:
            init.constant_(model.bias.data, 0)
    else:
        pass 
Example #2
Source File: ibnbresnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #3
Source File: revnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #4
Source File: inceptionv3.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for module in self.modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #5
Source File: octresnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #6
Source File: wrn_cifar.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #7
Source File: pyramidnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #8
Source File: squeezenext.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #9
Source File: pyramidnet_cifar.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #10
Source File: shakedropresnet_cifar.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #11
Source File: efficientnetedge.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #12
Source File: mixnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #13
Source File: shufflenet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #14
Source File: shakeshakeresnet_cifar.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #15
Source File: diracnetv2.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #16
Source File: resdropresnet_cifar.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #17
Source File: inceptionresnetv2.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #18
Source File: isqrtcovresnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #19
Source File: airnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #20
Source File: densenet_cifar.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #21
Source File: densenet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #22
Source File: efficientnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #23
Source File: resnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #24
Source File: vgg.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #25
Source File: resattnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #26
Source File: airnext.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #27
Source File: preresnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #28
Source File: sharesnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #29
Source File: shufflenetv2.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0) 
Example #30
Source File: fishnet.py    From imgclsmob with MIT License 5 votes vote down vote up
def _init_params(self):
        for name, module in self.named_modules():
            if isinstance(module, nn.Conv2d):
                init.kaiming_uniform_(module.weight)
                if module.bias is not None:
                    init.constant_(module.bias, 0)