MCPcopy Create free account
hub / github.com/LARS-research/TabGNN / forward

Method forward

models/utils.py:199–210  ·  view source on GitHub ↗
(self, input, i_type)

Source from the content-addressed store, hash-verified

197 nn.init.uniform_(b, -bound, bound)
198
199 def forward(self, input, i_type):
200 assert input.dtype == torch.float32 and i_type.dtype == torch.int64
201 out = torch.empty(input.shape[0], self.out_features).fill_(np.nan).to(input)
202 for t, w in enumerate(self.weight):
203 idxs_this_type = (i_type == t).nonzero()[:, 0]
204 in_this_type = input[idxs_this_type]
205 out_this_type = in_this_type.matmul(w.t())
206 if self.bias is not None:
207 out_this_type += self.bias[t]
208 out[idxs_this_type] = out_this_type
209
210 return out
211
212 # This is a correct but memory-intensive version of forward()
213 # def forward(self, input, i_type):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected