The forward method
h = x
for layer in self.layers[:-1]:
h = self.f(layer(h))
h = self.layers[-1](h)
// Shape the output, squeezing the parameter dimension if all ones
if self.output_multiplier == 1:
return h
else:
h = h.reshape(list(x.size()[:-1]) + [self.output_multiplier])
if self.count_params == 1: