Create a new L2Conv2D layer :param num_prototypes: The number of prototypes in the layer :param num_features: The number of channels in the input features :param w_1: Width of the prototypes :param h_1: Height of the prototypes
(self, num_prototypes, num_features, w_1, h_1)
| 11 | """ |
| 12 | |
| 13 | def __init__(self, num_prototypes, num_features, w_1, h_1): |
| 14 | """ |
| 15 | Create a new L2Conv2D layer |
| 16 | :param num_prototypes: The number of prototypes in the layer |
| 17 | :param num_features: The number of channels in the input features |
| 18 | :param w_1: Width of the prototypes |
| 19 | :param h_1: Height of the prototypes |
| 20 | """ |
| 21 | super().__init__() |
| 22 | # Each prototype is a latent representation of shape (num_features, w_1, h_1) |
| 23 | prototype_shape = (num_prototypes, num_features, w_1, h_1) |
| 24 | self.prototype_vectors = nn.Parameter(torch.randn(prototype_shape), requires_grad=True) |
| 25 | |
| 26 | def forward(self, xs): |
| 27 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected