albanD:

class LinearWeightedAvg(torch.nn.Module): def init(self, n_neurons): super(LinearWeightedAvg, self).init() self.weight_inp1 = torch.nn.Parameter(torch.randn(1, n_neurons)) self.weight_inp2 = torch.nn.Parameter(torch.randn(1, n_neurons)) def forward(self, input1, input2): return input1 * self.weight_inp2 + input2 * self.weight_inp2


awesome! wasn’t sure about the usage of torch.nn.Parameter but this made it clear. Used xavier for initialization and seems to be working.