Based on the error message it seems that either one of the used objects (x or y) or both are a tuple instead of tensors.
Could you check the type and make sure the to() operation is only called on tensors directly?