MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / reset_parameters

Method reset_parameters

python/oneflow/nn/modules/linear.py:120–127  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

118 self.reset_parameters()
119
120 def reset_parameters(self) -> None:
121 if os.getenv("ONEFLOW_LINEAR_EMBEDDING_SKIP_INIT", "0") == "1":
122 return
123 flow.nn.init.kaiming_uniform_(self.weight, a=math.sqrt(5))
124 if self.bias is not None:
125 (fan_in, _) = _calculate_fan_in_and_fan_out(self.weight)
126 bound = 1 / math.sqrt(fan_in)
127 flow.nn.init.uniform_(self.bias, -bound, bound)
128
129 def forward(self, x):
130 if self.use_fused_matmul_bias:

Callers 1

__init__Method · 0.95

Calls 1

Tested by

no test coverage detected