Hello,
I would like to train a combination of nets, namely apply different nets to the input depending on the classification given by the classifier.
For example the forward could look like (simplified for clarity sake)
def forward(self,x):
label = classifier(x)
if label==1:
x = othernet(x)
return x,label
however I get the following error “RuntimeError: bool value of Variable objects containing non-empty torch.cuda.ByteTensor is ambiguous”
From what I understand, label is a batchsize x 1 tensor so that the “if” statement is ambiguous. How can I make it apply “othernet” to only the samples that have label 1? (and still have autograd work, of course)
A solution would be to use select_index, but is there something simpler?
Thanks for your help