Thank you for reply. For now I have resolved the issue by opening the below loop in terms of array
for tt in range(1,tau):
        #pdb.set_trace()
        alpha[:,tt] = torch.transpose((torch.mv(torch.transpose(T,0,1),alpha[:,tt-1].clone())*bb[:,tt]),-1,0)
        rho[0,tt] = torch.sum(alpha[:,tt].clone())
        alpha[:,tt] = alpha[:,tt].clone()/rho[0,tt]

now the error is gone. There must be another way to keep the loop but i couldn’t figure it out.
Still waiting for suggestions. Thanks in advance.