Summary:
See https://github.com/pytorch/pytorch/pull/16325/files#r259576901
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17474
Differential Revision:
D14209549
Pulled By: yf225
fbshipit-source-id:
2ae091955ae17f5d1540f7d465739c4809c327f8
PyObject * THCPModule_setRNGState(PyObject *_unused, PyObject *obj)
{
HANDLE_TH_ERRORS
- auto& data_type = THPVariable_Unpack(obj).type();
- if (!THPVariable_Check(obj) || at::globalContext().getNonVariableType(data_type.backend(), data_type.scalarType()).ID() != at::TypeID::CPUByte) {
+ if (!THPVariable_Check(obj) ||
+ at::globalContext().getNonVariableType(THPVariable_Unpack(obj).type().backend(), THPVariable_Unpack(obj).type().scalarType()).ID() != at::TypeID::CPUByte) {
throw TypeError("set_rng_state expects a torch.ByteTensor, but got %s",
Py_TYPE(obj)->tp_name);
}