我的问题是否正确?我到处看,但找不到任何东西。我很确定这是我学习喀拉拉邦时解决的,但是如何在pytorch中实现呢?
pytorch可以轻松实现多个输出。
这是一个这样的网络。
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
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1040 次 |
最近记录: |