MCPcopy Create free account
hub / github.com/M-Nauta/ProtoTree / __init__

Method __init__

util/l2conv.py:13–24  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected