本文簡要介紹python語言中 torch.nn.init.kaiming_normal_
的用法。
用法:
torch.nn.init.kaiming_normal_(tensor, a=0, mode='fan_in', nonlinearity='leaky_relu')
tensor-一個n維
torch.Tensor
a-此層之後使用的整流器的負斜率(僅與
'leaky_relu'
一起使用)mode-
'fan_in'
(默認)或'fan_out'
。選擇'fan_in'
會保留前向傳遞中權重的方差大小。選擇'fan_out'
會保留反向傳播中的幅度。nonlinearity-非線性函數(
nn.functional
名稱),建議僅與'relu'
或'leaky_relu'
(默認)一起使用。
根據
Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification
- He, K. et al.中說明的方法用值填充輸入Tensor
。 (2015),使用正態分布。生成的張量將具有從 采樣的值,其中也稱為 He 初始化。
例子
>>> w = torch.empty(3, 5) >>> nn.init.kaiming_normal_(w, mode='fan_out', nonlinearity='relu')
參數:
相關用法
- Python PyTorch kaiming_uniform_用法及代碼示例
- Python PyTorch kron用法及代碼示例
- Python PyTorch kthvalue用法及代碼示例
- Python PyTorch keypointrcnn_resnet50_fpn用法及代碼示例
- Python PyTorch frexp用法及代碼示例
- Python PyTorch jvp用法及代碼示例
- Python PyTorch cholesky用法及代碼示例
- Python PyTorch vdot用法及代碼示例
- Python PyTorch ELU用法及代碼示例
- Python PyTorch ScaledDotProduct.__init__用法及代碼示例
- Python PyTorch gumbel_softmax用法及代碼示例
- Python PyTorch get_tokenizer用法及代碼示例
- Python PyTorch saved_tensors_hooks用法及代碼示例
- Python PyTorch positive用法及代碼示例
- Python PyTorch renorm用法及代碼示例
- Python PyTorch AvgPool2d用法及代碼示例
- Python PyTorch MaxUnpool3d用法及代碼示例
- Python PyTorch Bernoulli用法及代碼示例
- Python PyTorch Tensor.unflatten用法及代碼示例
- Python PyTorch Sigmoid用法及代碼示例
- Python PyTorch Tensor.register_hook用法及代碼示例
- Python PyTorch ShardedEmbeddingBagCollection.named_parameters用法及代碼示例
- Python PyTorch sqrt用法及代碼示例
- Python PyTorch PackageImporter.id用法及代碼示例
- Python PyTorch column_stack用法及代碼示例
注:本文由純淨天空篩選整理自pytorch.org大神的英文原創作品 torch.nn.init.kaiming_normal_。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。