diff --git a/csrc/tensor.cpp b/csrc/tensor.cpp index 0b0474a..00ee41b 100644 --- a/csrc/tensor.cpp +++ b/csrc/tensor.cpp @@ -209,7 +209,7 @@ extern "C" { } if (strcmp(tensor1->device, tensor2->device) != 0) { - fprintf(stderr, "Tensors must be on the same device\n"); + fprintf(stderr, "Tensors must be on the same device: %s and %s\n", &tensor1->device, &tensor2->device); exit(1); } diff --git a/norch/__pycache__/tensor.cpython-38.pyc b/norch/__pycache__/tensor.cpython-38.pyc index 90ed407..dc2de63 100644 Binary files a/norch/__pycache__/tensor.cpython-38.pyc and b/norch/__pycache__/tensor.cpython-38.pyc differ diff --git a/norch/tensor.py b/norch/tensor.py index f23f45c..07b07e9 100644 --- a/norch/tensor.py +++ b/norch/tensor.py @@ -84,6 +84,8 @@ class Tensor: Tensor._C.to_device.restype = None Tensor._C.to_device(self.tensor, self.device_ctype) + return self + def __getitem__(self, indices): if len(indices) != self.ndim: raise ValueError("Number of indices must match the number of dimensions")