Fix internal build

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78282

Approved by: https://github.com/davidberard98
This commit is contained in:
Elias Ellison
2022-05-25 11:07:03 -07:00
committed by PyTorch MergeBot
parent 5e03dfd36d
commit 13e444bfa5
2 changed files with 4 additions and 6 deletions

View File

@ -42,10 +42,6 @@ static c10::Device noop_device_fn(const PyInterpreter*, const TensorImpl*) {
"attempted to device Tensor with nontrivial PyObject after corresponding interpreter died");
}
c10::Device PyInterpreter::device(const TensorImpl* self) const {
return (*device_fn_)(this, self);
}
void PyInterpreter::disarm() noexcept {
name_fn_ = &noop_name_fn;
decref_fn_ = &noop_decref_fn;

View File

@ -1,5 +1,6 @@
#pragma once
#include <c10/core/Device.h>
#include <c10/macros/Macros.h>
#include <c10/util/intrusive_ptr.h>
#include <c10/util/python_stub.h>
@ -13,7 +14,6 @@ struct IValue;
class OperatorHandle;
struct TensorImpl;
struct SafePyObject;
struct Device;
} // namespace c10
namespace torch {
@ -188,7 +188,9 @@ struct C10_API PyInterpreter {
return (*is_contiguous_fn_)(this, self);
}
__ubsan_ignore_function__ c10::Device device(const TensorImpl* self) const;
__ubsan_ignore_function__ c10::Device device(const TensorImpl* self) const {
return (*device_fn_)(this, self);
}
// Disarm this PyInterpreter, making all of its methods noops.
// Because the function pointers are raw pointers (not atomics),