Time2Vec-PyTorch icon indicating copy to clipboard operation
Time2Vec-PyTorch copied to clipboard

Why Linear output is 2 for Model

Open jaideep11061982 opened this issue 3 years ago • 2 comments

Can you please explain why we have got 2 dim for fc output in Model.py. ?

jaideep11061982 avatar Oct 29 '21 13:10 jaideep11061982

Hello, I have the same question, do you know the result of the question?

rhythming avatar Jan 10 '22 09:01 rhythming

I'll guess that is because he uses nn.CrossEntropyLoss() for the binary classification in the toy dataset. In my opinion, this should be a parameter you can set (see below), so that you can use the model also in a non-binary target setting.

class Model(nn.Module):
    def __init__(self, activation, hiddem_dim, out_dim):
        super(Model, self).__init__()
        if activation == "sin":
            self.l1 = SineActivation(1, hiddem_dim)
        elif activation == "cos":
            self.l1 = CosineActivation(1, hiddem_dim)
        
        self.fc1 = nn.Linear(hiddem_dim, out_dim)

FloCF avatar Jan 26 '22 16:01 FloCF