(self)
| 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: |
no test coverage detected