1 #include <ATen/core/VariableHooksInterface.h> 2 3 namespace at::impl { 4 5 namespace { 6 VariableHooksInterface* hooks = nullptr; 7 } 8 SetVariableHooks(VariableHooksInterface * h)9void SetVariableHooks(VariableHooksInterface* h) { 10 hooks = h; 11 } GetVariableHooks()12VariableHooksInterface* GetVariableHooks() { 13 TORCH_CHECK(hooks, "Support for autograd has not been loaded; have you linked against libtorch.so?") 14 return hooks; 15 } HasVariableHooks()16bool HasVariableHooks() { 17 return hooks != nullptr; 18 } 19 20 } // namespace at::impl 21