Data must be a sequence (got numpy.int64)?

state = Tensor(state).to(device)

It shows that particular error whenever it tries to execute the above line. Can anyone please explain what is going on here and how to rectify the problem.

Thanks a lot!

Could you try to run

state = torch.from_numpy(state)

expected np.ndarray (got numpy.int64)
^ I get the above error after running the line you suggested

Yeah, you are right.
You have to pass a valid np.array to the function, so

state = torch.from_numpy(np.array(state))

should work.

3 Likes

Try torch.as_tensor():

print(torch.as_tensor(1.))
4 Likes