當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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_。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。