RuntimeError: shape '[-1, 128]' is invalid for input of size 97250

Blockquote
class Linear_overtime(nn.Module):
def init(self, input_size, hidden_size,bias=True):
super(Linear_overtime, self).init()
self.fc = nn.Linear(input_size, hidden_size, bias=bias)
self.input_size = input_size
self.hidden_size = hidden_size

def forward(self, x):
    y = x.contiguous().view(-1, self.input_size)
    y = self.fc(y)
    y = y.view(x.size()[0], x.size()[1], self.hidden_size)
    return y

class UnICORNN(nn.Module):
def init(self, ninp, nhid, nout, dt, alpha, n_layers, drop=0.1):
super(UnICORNN, self).init()
self.nhid=nhid
self.drop = drop
self.nlayers = n_layers
self.DIs=nn.ModuleList()
denseinput=Linear_overtime(ninp, nhid)
self.DIs.append(denseinput)
for x in range(self.nlayers - 1):
denseinput = Linear_overtime(nhid, nhid)
self.DIs.append(denseinput)
self.classifier = nn.Linear(nhid, nout)
self.init_weights()
self.RNNs =
for x in range(self.nlayers):
rnn = UnICORNN_recurrence(nhid,dt,alpha)
self.RNNs.append(rnn)
self.RNNs = torch.nn.ModuleList(self.RNNs)

def init_weights(self):
    for name, param in self.named_parameters():
        if ('fc' in name) and 'weight' in name:
            nn.init.kaiming_uniform_(param, a=8, mode='fan_in')
        if 'classifier' in name and 'weight' in name:
            nn.init.kaiming_normal_(param.data)
        if 'bias' in name:
            param.data.fill_(0.0)

def forward(self, input):
    rnnoutputs={}
    rnnoutputs['outlayer-1']=input
    for x in range(len(self.RNNs)):
        rnnoutputs['dilayer%d'%x]=self.DIs[x](rnnoutputs['outlayer%d'%(x-1)])
        rnnoutputs['outlayer%d'%x]= self.RNNs[x](rnnoutputs['dilayer%d'%x])
        rnnoutputs['outlayer%d' % x] = dropout_overtime(rnnoutputs['outlayer%d' % x], self.drop,self.training)
    temp=rnnoutputs['outlayer%d'%(len(self.RNNs)-1)][-1]
    output = self.classifier(temp)
    return output

Blockquote
here input_size I pass is 128,when I change input_size to 97250,RuntimeError: shape ‘[-1, 97250]’ is invalid for input of size 96450 this error message shows up
Please help!!!Urgently

As the error message shows, the view operation is invalid for the currently used input shape.
Based on the reported shapes, it seems the input to the model has a shape of [96450] while you are trying to create a view of [-1, 97250] which requires more elements than the tensor contains.