Is my question even right? I looked everywhere but couldn't find a single thing. I'm pretty sure this was addressed when I learned keras, but how do I implement it in pytorch?
Neural Networks for Multi-OutputsNeural network models also support multi-output regression and have the benefit of learning a continuous function that can model a more graceful relationship between changes in input and output.
Multiple outputs can be trivially achieved with pytorch.
Here is one such network.
import torch.nn as nn
class NeuralNetwork(nn.Module):
def __init__(self):
super(NeuralNetwork, self).__init__()
self.linear1 = nn.Linear(in_features = 3, out_features = 1)
self.linear2 = nn.Linear(in_features = 3,out_features = 2)
def forward(self, x):
output1 = self.linear1(x)
output2 = self.linear2(x)
return output1, output2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With