How can I make the output form of nn.rnn into [torch.Tensor] like nn.linear?
My MLP code is
class sample(nn.Module):
def __init__(self):
super(sample, self).__init__()
self.n = nn.Linear(1, 64)
self.nn = nn.Linear(64, 3)
def forward(self, t, is_train = False, y = None):
# t = torch.Size([128,1]) / t = <class 'torch.Tensor'>
ot = self.n(t)
ott = self.nn(ot)
return ott
and I tried
class sample(nn.Module):
def __init__(self, input_size, hidden_dim, num_layer):
super(NNfunc, self).__init__()
self.input_size = input_size
self.hidden_dim = hidden_dim
self.num_layer = num_layer
self.rnn = nn.rnn(1, 3, 1)
def forward(self, t, is_train = False, y = None):
output = self.rnn(t)
return output
but I think this is wrong,
I want to make [output] in the form of [torch.tensor], how should I modify the code?