(self, x)
| 333 | self.b = None |
| 334 | |
| 335 | def forward(self, x): |
| 336 | if self.b: |
| 337 | self.device_check(x, self.W, self.b) |
| 338 | self.dtype_check(x, self.W, self.b) |
| 339 | else: |
| 340 | self.device_check(x, self.W) |
| 341 | self.dtype_check(x, self.W) |
| 342 | |
| 343 | assert x.shape[1] == self.W.shape[0], ( |
| 344 | "Linear layer expects input features size %d received %d" % |
| 345 | (self.W.shape[0], x.shape[1])) |
| 346 | |
| 347 | y = autograd.matmul(x, self.W) |
| 348 | if self.bias: |
| 349 | y = autograd.add_bias(y, self.b, axis=0) |
| 350 | return y |
| 351 | |
| 352 | def get_params(self): |
| 353 | if self.bias: |
nothing calls this directly
no test coverage detected