xref: /aosp_15_r20/external/pytorch/torch/csrc/jit/passes/lower_tuples.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <torch/csrc/jit/ir/ir.h>
4 
5 namespace torch::jit {
6 
7 // removes tuples where TupleConstruct and TupleUnpack are matched
8 // but leaves tuples in place across if statements, loops, and as inputs/outputs
9 TORCH_API void LowerSimpleTuples(const std::shared_ptr<Graph>& graph);
10 
11 // removes _all_ tuples and raises an error if some cannot be removed
12 // this is used by ONNX to ensure there are not tuples before conversion,
13 // but will not work on graphs whose inputs contain tuples.
14 TORCH_API void LowerAllTuples(const std::shared_ptr<Graph>& graph);
15 
16 TORCH_API void LowerSimpleTuples(Block* block);
17 
18 } // namespace torch::jit
19