JSX_TTS / torch /include /ATen /core /PythonFallbackKernel.h
UMMJ's picture
Upload 5875 files
9dd3461
raw
history blame contribute delete
530 Bytes
#pragma once
#include <ATen/core/TorchDispatchUtils.h>
namespace at {
namespace impl {
struct TORCH_API RestorePythonTLSSnapshot {
RestorePythonTLSSnapshot();
~RestorePythonTLSSnapshot();
private:
c10::impl::LocalDispatchKeySet saved_;
c10::impl::ForceDispatchKeyGuard guard_;
};
// RAII guard to make working with the above TLS safer.
struct TORCH_API MaybeSetTLSOnEntryGuard {
public:
MaybeSetTLSOnEntryGuard();
~MaybeSetTLSOnEntryGuard();
private:
bool value_set_;
};
} // namespace impl
} // namespace at