We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e04036e commit 7568f78Copy full SHA for 7568f78
1 file changed
src/eir/models/output/tabular/shared_mlp_residual.py
@@ -1,3 +1,4 @@
1
+import math
2
from dataclasses import dataclass
3
from typing import TYPE_CHECKING
4
@@ -180,8 +181,12 @@ def _build_batched(
180
181
self.batched_proj_weight = nn.Parameter(
182
torch.empty(n_groups, max_outputs, fc_task_dim)
183
)
- self.batched_proj_bias = nn.Parameter(torch.zeros(n_groups, 1, max_outputs))
184
- nn.init.kaiming_uniform_(self.batched_proj_weight.view(-1, fc_task_dim))
+ self.batched_proj_bias = nn.Parameter(torch.empty(n_groups, 1, max_outputs))
185
+ for g in range(n_groups):
186
+ nn.init.kaiming_uniform_(self.batched_proj_weight[g], a=math.sqrt(5))
187
+ fan_in = fc_task_dim
188
+ bound = 1 / math.sqrt(fan_in)
189
+ nn.init.uniform_(self.batched_proj_bias[g], -bound, bound)
190
191
def forward(
192
self,
0 commit comments