Cadene / vqa.pytorch

Visual Question Answering in Pytorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why don't you apply a softmax function before the final prediction?

zwx8981 opened this issue · comments

HI, thank you for great work, I have a little question. As a classification task,we usually apply a softmax function to convert the output of a model into a probabilistic vector, each entry of which represents the probability of the input that belonging to the corresponding category. However, it seems that in your code the output of the Mutan model (the output of the second multimodel fusion followed by only a linear transformation without a softmax) is directly fed into the loss function. Is there any special consideration?

x = self.linear_classif(x)

commented

@zwx8981 Here we use nn.CrossEntropyLoss which combines nn.LogSoftmax and nn.NLLLoss. Thus, we don't need to add a softmax. It is already included.

@Cadene Thank you!