mirror of
https://github.com/pytorch/pytorch.git
synced 2025-11-06 09:17:11 +08:00
Fix the bug in dispatch_to when calling cpu() (#13700)
Summary: When we added to in #13146, we did not emit the cast correctly in one of the dispatch overloads, then when we call .cpu(), the dtype will always be the default float type, which is wrong. CC jamesr66a eellison Pull Request resolved: https://github.com/pytorch/pytorch/pull/13700 Differential Revision: D12968699 Pulled By: wanchaol fbshipit-source-id: c1aaf2bf6a163643ce5360797da61c68271d8bf8
This commit is contained in:
committed by
Facebook Github Bot
parent
90ea61800f
commit
411d89ca64
@ -259,7 +259,7 @@ static PyObject * THPVariable_invert(PyObject* self, PyObject* args) {
|
||||
|
||||
static Tensor dispatch_to(const Tensor & self, Device device, bool non_blocking, bool copy) {
|
||||
AutoNoGIL no_gil;
|
||||
return self.to(device, non_blocking, copy);
|
||||
return self.to(self.options().device(device), non_blocking, copy);
|
||||
}
|
||||
|
||||
static Tensor dispatch_to(const Tensor & self, ScalarType dtype, bool non_blocking, bool copy) {
|
||||
|
||||
Reference in New Issue
Block a user