xnn.common.models.ops.glorot_orthogonal_#

xnn.common.models.ops.glorot_orthogonal_(weight, scale=2.0)[source]#

Initialize a weight matrix as a (semi-)orthogonal matrix with Glorot variance.

The rows (or columns) are orthonormal, then the whole matrix is rescaled so that its elements have variance scale / (fan_in + fan_out): the initialization of the dense layers of DimeNet and SpookyNet.

Parameters:
  • weight (Tensor) – A 2-D weight tensor, modified in place.

  • scale (float, optional) – Variance numerator, by default 2.0 (Glorot).

Returns:

weight.

Return type:

Tensor