ptrblck:

Could you print i before trying t


sorry for late reply: the following contain torch.squeeze(Delta[:,i:i+1,:]))
def forward(self, input):
batch_size = input.size(0)
type_size = input.size(1)
step_size = input.size(2)
spatial_size = input.size(3)
    Hidden_State = self.initHidden(batch_size)
    C_State = self.initHidden(batch_size)
    X = torch.squeeze(input[:,0,:,:])
    X_last_obsv = torch.squeeze(input[:,1,:,:])
    Mask = torch.squeeze(input[:,2,:,:])
    Delta = torch.squeeze(input[:,3,:,:])
    
    hidden = None
    for i in range(step_size):
        Hidden_State = self.step(torch.squeeze(X[:,i:i+1,:])\
                                 , torch.squeeze(X_last_obsv[:,i:i+1,:])\
                                 , torch.squeeze(self.X_mean[:,i:i+1,:])\
                                 , C_State\
                                 , Hidden_State\
                                 , torch.squeeze(Mask[:,i:i+1,:])\
                                 , torch.squeeze(Delta[:,i:i+1,:]))
        
                                  
        if hidden is None:
            hidden = Hidden_State.unsqueeze(1)
        else:
            hidden = torch.cat((hidden, Hidden_State.unsqueeze(1)), 1)
       
            
    if self.output_last:
        prediction = self.output(hidden[:,-1,:])
        return prediction
    else:
        hidden = hidden.view(-1, self.hidden_size)
        prediction = self.output(hidden)
        return prediction

def initHidden(self, batch_size):
    #use_gpu = torch.cuda.is_available()
   # if use_gpu:
       # Hidden_State = Variable(torch.zeros(batch_size, self.hidden_size).cuda())
       # return Hidden_State
    #else:
    Hidden_State = Variable(torch.zeros(batch_size, self.hidden_size))
    C_State = Variable(torch.zeros(batch_size, self.hidden_size))
    return Hidden_State, C_State