1 #pragma once 2 3 #include <ATen/core/dispatch/Dispatcher.h> 4 5 // TODO: this can probably live in c10 6 7 8 namespace at::impl { 9 10 class TORCH_API PythonOpRegistrationTrampoline final { 11 static std::atomic<c10::impl::PyInterpreter*> interpreter_; 12 13 public: 14 // Returns true if you successfully registered yourself (that means 15 // you are in the hot seat for doing the operator registrations!) 16 static bool registerInterpreter(c10::impl::PyInterpreter*); 17 18 // Returns nullptr if no interpreter has been registered yet. 19 static c10::impl::PyInterpreter* getInterpreter(); 20 }; 21 22 } // namespace at::impl 23