xref: /aosp_15_r20/external/pytorch/torch/csrc/jit/passes/eliminate_no_ops.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <torch/csrc/jit/ir/ir.h>
4 
5 namespace torch::jit {
6 
7 // Remove ops that do nothing on the forward pass (like aten::detach).
8 // This pass is invoked as a part of freeze_module.
9 // This function also takes a set of custom ops to eliminate. All ops in this
10 // set must take their output as their first input, i.e. x = f(x, ...)
11 TORCH_API bool EliminateNoOps(
12     std::shared_ptr<Graph>& graph,
13     std::unordered_set<c10::Symbol> custom_ops = {});
14 
15 } // namespace torch::jit
16