as i am onto some multiclass classification problem,i need my model to return x1,x2,x3 for
grapheme_root,vowel_diacritic and consonant_diacritic class
so my ResNet implementation returns a tuple instead of tensor:
`x1 = self.fc1(x)
x2 = self.fc2(x)
x3 = self.fc3(x)
return x1,x2,x3`
i tried ensemble using this code :
`
num_features = 2000
class MyEnsemble(nn.Module):
def __init__(self, model, model1):
super(MyEnsemble, self).__init__()
self.model = model
self.model1 = model1
# vowel_diacritic
self.fc1 = nn.Linear(num_features,11)
# grapheme_root
self.fc2 = nn.Linear(num_features,168)
# consonant_diacritic
self.fc3 = nn.Linear(num_features,7)
def forward(self, x):
x1 = self.model(x.clone())
x1 = x1.view(x1.size(0), -1)
x2 = self.model1(x)
x2 = x2.view(x2.size(0), -1)
x = torch.cat((x1, x2), dim=1)
x1 = self.fc1(x)
x2 = self.fc2(x)
x3 = self.fc3(x)
return x1,x2,x3
`
but i get the error : TypeError: expected Tensor as element 0 in argument 0, but got tuple
how do i modify ensembler code to get rid of this error? thank you