(self, x)
| 707 | ) |
| 708 | |
| 709 | def forward(self, x): |
| 710 | # sanitize the device of params/states, TODO: better to decorate forward() |
| 711 | self.device_check(x, *[s for k, s in self.get_states().items()]) |
| 712 | self.dtype_check(x, *[s for k, s in self.get_states().items()]) |
| 713 | |
| 714 | assert (self.group >= 1 and self.in_channels % self.group |
| 715 | == 0), "please set reasonable group." |
| 716 | |
| 717 | assert (self.nb_kernels >= self.group and self.nb_kernels % self.group |
| 718 | == 0), "nb_kernels and group dismatched." |
| 719 | |
| 720 | y = autograd.conv2d(self.handle, x, self.W, self.b, self.odd_padding) |
| 721 | |
| 722 | if self.activation != "NOTSET": |
| 723 | if self.activation == "RELU": |
| 724 | y = autograd.relu(y) |
| 725 | |
| 726 | return y |
| 727 | |
| 728 | def get_params(self): |
| 729 | if self.bias: |
nothing calls this directly
no test coverage detected