/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
torch
/
csrc
/
jit
/
passes
/
/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/passes
mkdir
upload
Name
Size
Mode
Actions
quantization/
-
0755
rm
utils/
-
0755
rm
annotate_warns.h
192
0644
edit
dl
rm
bailout_graph.h
1129
0644
edit
dl
rm
batch_mm.h
163
0644
edit
dl
rm
canonicalize.h
492
0644
edit
dl
rm
canonicalize_graph_fuser_ops.h
177
0644
edit
dl
rm
clear_profiling.h
334
0644
edit
dl
rm
clear_undefinedness.h
889
0644
edit
dl
rm
common_subexpression_elimination.h
194
0644
edit
dl
rm
concat_opt.h
481
0644
edit
dl
rm
constant_pooling.h
177
0644
edit
dl
rm
constant_propagation.h
1287
0644
edit
dl
rm
create_autodiff_subgraphs.h
552
0644
edit
dl
rm
create_functional_graphs.h
323
0644
edit
dl
rm
cuda_graph_fuser.h
860
0644
edit
dl
rm
dead_code_elimination.h
1584
0644
edit
dl
rm
decompose_ops.h
168
0644
edit
dl
rm
erase_number_types.h
813
0644
edit
dl
rm
fixup_trace_scope_blocks.h
1673
0644
edit
dl
rm
fold_conv_bn.h
995
0644
edit
dl
rm
freeze_module.h
1236
0644
edit
dl
rm
frozen_conv_add_relu_fusion.h
233
0644
edit
dl
rm
frozen_conv_folding.h
872
0644
edit
dl
rm
frozen_graph_optimizations.h
435
0644
edit
dl
rm
frozen_ops_to_mkldnn.h
414
0644
edit
dl
rm
fuse_linear.h
526
0644
edit
dl
rm
fuse_relu.h
273
0644
edit
dl
rm
graph_fuser.h
1251
0644
edit
dl
rm
graph_rewrite_helper.h
1785
0644
edit
dl
rm
guard_elimination.h
390
0644
edit
dl
rm
hoist_conv_packed_params.h
211
0644
edit
dl
rm
inliner.h
199
0644
edit
dl
rm
inline_autodiff_subgraphs.h
275
0644
edit
dl
rm
inline_forked_closures.h
241
0644
edit
dl
rm
inline_fork_wait.h
547
0644
edit
dl
rm
inplace_check.h
168
0644
edit
dl
rm
insert_guards.h
453
0644
edit
dl
rm
integer_value_refinement.h
234
0644
edit
dl
rm
lift_closures.h
236
0644
edit
dl
rm
liveness.h
663
0644
edit
dl
rm
loop_unrolling.h
1006
0644
edit
dl
rm
lower_grad_of.h
348
0644
edit
dl
rm
lower_graph.h
750
0644
edit
dl
rm
lower_tuples.h
666
0644
edit
dl
rm
metal_rewrite.h
606
0644
edit
dl
rm
normalize_ops.h
536
0644
edit
dl
rm
onnx.h
967
0644
edit
dl
rm
pass_manager.h
4635
0644
edit
dl
rm
peephole.h
507
0644
edit
dl
rm
peephole_alias_sensitive.h
355
0644
edit
dl
rm
peephole_dict_idioms.h
1000
0644
edit
dl
rm
peephole_list_idioms.h
2003
0644
edit
dl
rm
peephole_non_tensor.h
342
0644
edit
dl
rm
prepack_folding.h
358
0644
edit
dl
rm
remove_dropout.h
280
0644
edit
dl
rm
remove_exceptions.h
954
0644
edit
dl
rm
remove_expands.h
175
0644
edit
dl
rm
remove_inplace_ops.h
296
0644
edit
dl
rm
remove_mutation.h
2674
0644
edit
dl
rm
remove_redundant_profiles.h
196
0644
edit
dl
rm
requires_grad_analysis.h
260
0644
edit
dl
rm
restore_mutation.h
1887
0644
edit
dl
rm
shape_analysis.h
463
0644
edit
dl
rm
specialize_autogradzero.h
656
0644
edit
dl
rm
subgraph_rewrite.h
4112
0644
edit
dl
rm
symbolic_shape_analysis.h
641
0644
edit
dl
rm
tensorexpr_fuser.h
2077
0644
edit
dl
rm
update_differentiable_graph_requires_grad.h
740
0644
edit
dl
rm
value_refinement_utils.h
2669
0644
edit
dl
rm
variadic_ops.h
993
0644
edit
dl
rm
vulkan_rewrite.h
576
0644
edit
dl
rm
xnnpack_rewrite.h
917
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/passes/pass_manager.h
(4635B)
#pragma once #include <torch/csrc/jit/ir/ir.h> /* `getCustomPrePasses()` returns a vector of passes that will be executed * after differentiation but before any fusion. This is the de-facto location * for compiler backends to insert passes. * * `getCustomPostPasses()` returns a vector of passes that will be * executed after differentiation and after fusion (if any). This is the * location for fusion cleanup passes if they are needed. * * Static registration of a pass can be done by creating a global * `Register{Pre,Post}Pass r(Pass)` variable in a compilation unit. * * pass_manager.h uses a Meyer's singleton to store a vector of `Pass`es, which * modify the IR graph in place. */ namespace torch { namespace jit { // A pass modifies a Graph in place. using GraphPass = std::function<void(std::shared_ptr<Graph>&)>; // Since Passes are std::functions, we associate a UUID to each pass, this way // if we want to deregister a pass, we have something to reference it by. using GraphPassNameType = unsigned int; // Start UUID at 1 static GraphPassNameType graphPassID = 1; // Graph pass entries have a name associated with them using GraphPassEntry = std::pair<GraphPass, GraphPassNameType>; // Return currently registered passes. Passes are stored in a static vector TORCH_API std::vector<std::pair<GraphPass, GraphPassNameType>>& getCustomPostPasses(); TORCH_API std::vector<std::pair<GraphPass, GraphPassNameType>>& getCustomPrePasses(); TORCH_API GraphPassNameType registerPostPass(GraphPass p); TORCH_API GraphPassNameType registerPrePass(GraphPass p); // Look up pass by name passed in, remove it from registered passes TORCH_API void clearPostPass(GraphPassNameType p); TORCH_API void clearPrePass(GraphPassNameType p); // Remove all passes TORCH_API void clearAllPostPasses(); TORCH_API void clearAllPrePasses(); // LEGACY CALL struct TORCH_API RegisterPostPass { RegisterPostPass(GraphPass p); }; using RegisterPass = RegisterPostPass; /* * PassManager is a wrapper on the register/clear PostPass functions above. It * will register the pass provided in "registerPass" and will hold on to its * associated name that way clearPass can be later called and will delete the * pass used to register when called. * * PassManager is templated because we want static variables based on a * particular GraphPass. When deriving from PassManager, you should send as the * template parameter your derived class as you would for the curiously * recurring template pattern. This template parameter isn't actually used and * is simply done to prevent static members from being shared across derived * types. */ template <typename DerivedType> struct C10_EXPORT PassManager { private: // We want this class to be abstract because it's virtual void abstract() = 0; protected: /* * isRegistered() will return if a pass has been registered * isRegistered(true) will change the value of the internal static bool * * There's an internal static bool to this function to keep track of the * state, this is so when functions are derived from this class, they don't * have to worry about initializing the static members. */ static bool isRegistered(bool flip_bit = false) { static bool val = false; if (flip_bit) val = !val; return val; } /* * name() will return the name of the registered pass * name(pass_name, true) will set the name of the pass * Similarly to isRegistered we use an internal static variable to hold the * name. */ static GraphPassNameType passID( GraphPassNameType PassID = 0, bool set = false) { static GraphPassNameType pass_id = 0; if (set) pass_id = PassID; return pass_id; } public: // registerPass(pass) will register the pass provided and set the // name/isRegistered functions appropriately, it returns a bool value // indicating whether the given pass is already registered previously. static bool registerPass(GraphPass p) { if (!isRegistered()) { // If we don't already have a registered pass, register pass // hold on to its name, change isRegistered to true passID(registerPostPass(std::move(p)), true); isRegistered(true); return false; } return true; } // Calls ClearPostPass(passID()) static void clearPass() { // If the pass is registered, clear it and change isRegistered to false. if (isRegistered()) { clearPostPass(passID()); isRegistered(true); } } // clang-tidy requires virtual destructor; virtual ~PassManager() = default; }; } // namespace jit } // namespace torch
Save
cmd:
run