Fix add tensor
This commit is contained in:
parent
acd8b1dba3
commit
b5172b5bdb
3 changed files with 3 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue