Since my data was originally a numpy.ndarray, I changed the data using torch.from_numpy(). I realized I was able to solve the error by this. But it gives me a new error:
RuntimeError: expected scalar type Float but found Double