1 #pragma once 2 3 #include <ATen/core/ivalue_inl.h> 4 5 #include <torch/csrc/jit/mobile/code.h> 6 #include <torch/csrc/jit/mobile/function.h> 7 #include <torch/csrc/jit/serialization/import_export_functions.h> 8 #include <string> 9 #include <unordered_map> 10 #include <vector> 11 12 namespace torch::jit { 13 struct Instruction; 14 struct Upgrader { 15 int min_version; 16 int max_version; 17 std::string upgrader_name; 18 int index; 19 }; 20 21 // From operator_versions.yaml 22 TORCH_API const std::unordered_map<std::string, std::vector<Upgrader>> 23 getOperatorVersionMapForMobile(); 24 25 struct OperatorString { 26 const std::string name; 27 const std::string overload_name; 28 const std::optional<int> num_specified_args; 29 }; 30 31 struct ByteCodeFunctionWithOperator { 32 mobile::Function& function; 33 std::vector<OperatorString> operators; 34 }; 35 36 TORCH_API const std::vector<ByteCodeFunctionWithOperator>& 37 getUpgraderBytecodeList(); 38 39 } // namespace torch::jit 40