(self, X)
| 80 | return out |
| 81 | |
| 82 | def forward_pass(self, X): |
| 83 | if len(X.shape) == 2: |
| 84 | # input is a regular layer |
| 85 | return self._forward_pass(X) |
| 86 | elif len(X.shape) == 4: |
| 87 | # input is a convolution layer |
| 88 | N, C, H, W = X.shape |
| 89 | x_flat = X.transpose(0, 2, 3, 1).reshape(-1, C) |
| 90 | out_flat = self._forward_pass(x_flat) |
| 91 | return out_flat.reshape(N, H, W, C).transpose(0, 3, 1, 2) |
| 92 | else: |
| 93 | raise NotImplementedError( |
| 94 | "Unknown model with dimensions = {}".format(len(X.shape)) |
| 95 | ) |
| 96 | |
| 97 | def _backward_pass(self, delta): |
| 98 | # unfold the variables stored in cache |
nothing calls this directly
no test coverage detected