#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION) #pragma once #include #include #include namespace at::impl { struct TORCH_API ThreadLocalPythonObjects { static void set(const std::string& key, std::shared_ptr value); static const std::shared_ptr& get(const std::string& key); static bool contains(const std::string& key); static const ThreadLocalPythonObjects& get_state(); static void set_state(ThreadLocalPythonObjects state); private: std::unordered_map> obj_dict_; }; } // namespace at::impl #else #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined." #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)