Okay, I thought, just by doing X.to(device) is enough.
X = torch.from_numpy(X_Scaled).float().to(device)
for i, val in enumerate(X):
    X = X.to(device)

#before
train_data = X[3:, :-1]
target_data = X[3:, 1:]
test_data = X[:3, :-1]
test_target = X[:3, 1:]

#after

train_data = X[3:, :-1].to(device)
target_data = X[3:, 1:].to(device)
test_data = X[:3, :-1].to(device)
test_target = X[:3, 1:].to(device)