1#pragma once
2
3#include <c10/macros/Export.h>
4#include <c10/util/Optional.h>
5
6#include <memory>
7#include <unordered_map>
8#include <unordered_set>
9
10namespace torch {
11namespace jit {
12
13// Struct storing metadata of an operator that can be useful for versioning
14struct OperatorInfo {
15 // The number of arguments within the schema of the op
16 c10::optional<int> num_schema_args;
17};
18
19struct RuntimeCompatibilityInfo {
20 std::pair<uint64_t, uint64_t> min_max_supported_bytecode_version;
21 std::unordered_map<std::string, OperatorInfo> operator_info;
22 std::unordered_set<std::string> supported_types;
23 std::pair<uint64_t, uint64_t> min_max_supported_opperator_versions;
24
25 // Factory Method
26 static TORCH_API RuntimeCompatibilityInfo get();
27};
28
29TORCH_API uint64_t _get_runtime_bytecode_version();
30
31TORCH_API std::pair<uint64_t, uint64_t> _get_runtime_bytecode_min_max_versions();
32
33TORCH_API std::pair<uint64_t, uint64_t>
34_get_runtime_operators_min_max_versions();
35
36TORCH_API std::unordered_map<std::string, OperatorInfo>
37_get_runtime_ops_and_info();
38
39TORCH_API std::unordered_set<std::string> _get_mobile_supported_types();
40
41TORCH_API std::unordered_set<std::string> _get_loaded_custom_classes();
42
43} // namespace jit
44} // namespace torch
45