当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python PyTorch orthogonal_用法及代码示例


本文简要介绍python语言中 torch.nn.init.orthogonal_ 的用法。

用法:

torch.nn.init.orthogonal_(tensor, gain=1)

参数

  • tensor-n 维 torch.Tensor ,其中

  • gain-可选比例因子

用(半)正交矩阵填充输入 Tensor,如 Exact solutions to the nonlinear dynamics of learning in deep linear neural networks - Saxe, A. et al 中所述。 (2013)。输入张量必须至少有 2 个维度,对于超过 2 个维度的张量,尾随维度会被展平。

例子

>>> w = torch.empty(3, 5)
>>> nn.init.orthogonal_(w)

相关用法


注:本文由纯净天空筛选整理自pytorch.org大神的英文原创作品 torch.nn.init.orthogonal_。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。