Skip to content

Commit 63893c3

Browse files
apaszkesoumith
authored andcommitted
Fix auto-gpu semantics for indexing
1 parent f8ae347 commit 63893c3

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

torch/csrc/generic/Tensor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ static PyObject * THPTensor_(getValue)(THPTensor *self, PyObject *index)
599599
THPByteTensor *mask = THPByteTensor_Check(index) ? (THPByteTensor*)index : NULL;
600600
#else
601601
THCPByteTensor *mask = THCPByteTensor_Check(index) ? (THCPByteTensor*)index : NULL;
602+
THCPAutoGPU __gpu_guard(NULL, (PyObject*)self);
602603
#endif
603604
if (mask) {
604605
THTensorPtr t = THTensor_(new)(LIBRARY_STATE_NOARGS);
@@ -636,6 +637,7 @@ static int THPTensor_(setValue)(THPTensor *self, PyObject *index, PyObject *valu
636637
THPByteTensor *mask = THPByteTensor_Check(index) ? (THPByteTensor*)index : NULL;
637638
#else
638639
THCPByteTensor *mask = THCPByteTensor_Check(index) ? (THCPByteTensor*)index : NULL;
640+
THCPAutoGPU __gpu_guard(NULL, (PyObject*)self);
639641
#endif
640642
if (mask) {
641643
if (THPUtils_(checkReal)(value)) {

torch/nn/init.py

Whitespace-only changes.

0 commit comments

Comments
 (0)