xref: /aosp_15_r20/external/pytorch/torch/csrc/jit/passes/canonicalize.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <torch/csrc/jit/ir/ir.h>
4 
5 namespace torch::jit {
6 
7 TORCH_API std::shared_ptr<Graph> Canonicalize(
8     const std::shared_ptr<Graph>& graph,
9     bool keep_unique_names = true);
10 
11 TORCH_API void CanonicalizeOutputs(std::shared_ptr<Graph>& graph);
12 
13 TORCH_API std::optional<const Use> firstOrLastUse(Value* v, bool find_first);
14 
15 TORCH_API bool isBeforeOrAfter(
16     const Use& a,
17     const Use& b,
18     bool checking_before);
19 
20 } // namespace torch::jit
21