From b5172b5bdb3fd3d3eefe36f64dc484406af75a2c Mon Sep 17 00:00:00 2001 From: lucasdelimanogueira Date: Mon, 29 Apr 2024 10:12:01 -0300 Subject: [PATCH] Fix add tensor --- csrc/tensor.cpp | 2 +- norch/__pycache__/tensor.cpython-38.pyc | Bin 6391 -> 6386 bytes norch/tensor.py | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) 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 90ed407d182cee96060dfb641739485399430eb0..dc2de63d904644ec8f364b268f5e2bb6cb219b67 100644 GIT binary patch delta 40 ucmexv_{oqfl$V!_0SI2|P2^h2%Pq{%%*e=)!Whh;$-8mSO7Y2A61@P?y$X{6 delta 43 xcmexl_}!2zl$V!_0SLD0PUKq3%PY*#%*e=)!Whh;$+vOON^zzlr^!hY69DRb3labT 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")