Hi All,
I am instantiating an architecture like this:
class Discriminator_classwise(nn.Module):
    def __init__(self, inc=4096, num_class=126):
        super(Discriminator, self).__init__()
        self.classfier_list = []
        for _ in range(num_class):
            self.classfier_list.append(nn.Sequential(nn.Linear(inc,512),nn.Linear(512,512),nn.Linear(512,2)))

    def forward(self, x, reverse=False, eta=1.0, choose_class = 0):
        if reverse:
            x = grad_reverse(x, eta)
        which_classifier = self.classfier_list[choose_class]
        x_out = which_classifier(x)
        return x_out

Essentially, what I am doing is I want to choose a classifier from the list of classifier according to the class that is predicted for my input.
Could someone help me in writing a forward function for this, which takes an argument which is a class index and returns the forward passed tensor through the desired classifier?
Thanks in advance,
Megh