1 | #pragma once |
2 | |
3 | #include <torch/csrc/Export.h> |
4 | #include <string> |
5 | #include <unordered_map> |
6 | |
7 | #include <c10/util/Optional.h> |
8 | #include <torch/csrc/Export.h> |
9 | |
10 | namespace torch { |
11 | namespace jit { |
12 | |
13 | struct Graph; |
14 | struct Value; |
15 | |
16 | // \brief Parse IR from \p STR constructing the corresponding IR in\ GRAPH. |
17 | // if parse_tensor_constants is true will construct empty tensors |
18 | // for Tensor constants with random or unitialized contents, otherwise will |
19 | // throw |
20 | TORCH_API void parseIR( |
21 | const std::string& str, |
22 | torch::jit::Graph* graph, |
23 | bool parse_tensor_constants = false); |
24 | |
25 | /** \brief Parse IR from \p STR constructing the corresponding IR in\ GRAPH. |
26 | * |
27 | * \p VMAP is filled with String to Value pairs allowing to index Values in the |
28 | * newly created graph by their name in the original IR string. |
29 | * if parse_tensor_constants is true will construct empty tensors |
30 | * for Tensor constants with random or unitialized contents, otherwise will |
31 | * throw |
32 | */ |
33 | TORCH_API void parseIR( |
34 | const std::string& str, |
35 | torch::jit::Graph* graph, |
36 | std::unordered_map<std::string, Value*>& vmap, |
37 | bool parse_tensor_constants = false); |
38 | |
39 | } // namespace jit |
40 | } // namespace torch |
41 | |