1 #pragma once 2 #include <c10/macros/Export.h> 3 #include <string> 4 #include <unordered_map> 5 #include <vector> 6 7 namespace torch::jit { 8 9 struct UpgraderEntry { 10 int bumped_at_version; 11 std::string upgrader_name; 12 std::string old_schema; 13 }; 14 15 // Toggle the behaviour of calculating version for the module. 16 // If this is true, we calculate solely based on upgraders 17 // If this is false, we calculate it based on historic per op version map 18 TORCH_API void calculate_package_version_based_on_upgraders(bool val); 19 20 TORCH_API bool get_version_calculator_flag(); 21 22 TORCH_API const std::unordered_map<std::string, std::vector<UpgraderEntry>>& 23 get_operator_version_map(); 24 25 TORCH_API void test_only_add_entry( 26 const std::string& op_name, 27 UpgraderEntry entry); 28 29 TORCH_API void test_only_remove_entry(const std::string& op_name); 30 31 TORCH_API void test_only_reset_flag(); 32 33 } // namespace torch::jit 34