/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/passes
NameSizeModeActions
quantization/-0755rm
utils/-0755rm
annotate_warns.h1920644editdlrm
bailout_graph.h11290644editdlrm
batch_mm.h1630644editdlrm
canonicalize.h4920644editdlrm
canonicalize_graph_fuser_ops.h1770644editdlrm
clear_profiling.h3340644editdlrm
clear_undefinedness.h8890644editdlrm
common_subexpression_elimination.h1940644editdlrm
concat_opt.h4810644editdlrm
constant_pooling.h1770644editdlrm
constant_propagation.h12870644editdlrm
create_autodiff_subgraphs.h5520644editdlrm
create_functional_graphs.h3230644editdlrm
cuda_graph_fuser.h8600644editdlrm
dead_code_elimination.h15840644editdlrm
decompose_ops.h1680644editdlrm
erase_number_types.h8130644editdlrm
fixup_trace_scope_blocks.h16730644editdlrm
fold_conv_bn.h9950644editdlrm
freeze_module.h12360644editdlrm
frozen_conv_add_relu_fusion.h2330644editdlrm
frozen_conv_folding.h8720644editdlrm
frozen_graph_optimizations.h4350644editdlrm
frozen_ops_to_mkldnn.h4140644editdlrm
fuse_linear.h5260644editdlrm
fuse_relu.h2730644editdlrm
graph_fuser.h12510644editdlrm
graph_rewrite_helper.h17850644editdlrm
guard_elimination.h3900644editdlrm
hoist_conv_packed_params.h2110644editdlrm
inliner.h1990644editdlrm
inline_autodiff_subgraphs.h2750644editdlrm
inline_forked_closures.h2410644editdlrm
inline_fork_wait.h5470644editdlrm
inplace_check.h1680644editdlrm
insert_guards.h4530644editdlrm
integer_value_refinement.h2340644editdlrm
lift_closures.h2360644editdlrm
liveness.h6630644editdlrm
loop_unrolling.h10060644editdlrm
lower_grad_of.h3480644editdlrm
lower_graph.h7500644editdlrm
lower_tuples.h6660644editdlrm
metal_rewrite.h6060644editdlrm
normalize_ops.h5360644editdlrm
onnx.h9670644editdlrm
pass_manager.h46350644editdlrm
peephole.h5070644editdlrm
peephole_alias_sensitive.h3550644editdlrm
peephole_dict_idioms.h10000644editdlrm
peephole_list_idioms.h20030644editdlrm
peephole_non_tensor.h3420644editdlrm
prepack_folding.h3580644editdlrm
remove_dropout.h2800644editdlrm
remove_exceptions.h9540644editdlrm
remove_expands.h1750644editdlrm
remove_inplace_ops.h2960644editdlrm
remove_mutation.h26740644editdlrm
remove_redundant_profiles.h1960644editdlrm
requires_grad_analysis.h2600644editdlrm
restore_mutation.h18870644editdlrm
shape_analysis.h4630644editdlrm
specialize_autogradzero.h6560644editdlrm
subgraph_rewrite.h41120644editdlrm
symbolic_shape_analysis.h6410644editdlrm
tensorexpr_fuser.h20770644editdlrm
update_differentiable_graph_requires_grad.h7400644editdlrm
value_refinement_utils.h26690644editdlrm
variadic_ops.h9930644editdlrm
vulkan_rewrite.h5760644editdlrm
xnnpack_rewrite.h9170644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/passes/remove_mutation.h (2674B)
#pragma once #include #include #include #include #include namespace torch { namespace jit { struct TORCH_API MutationRemover { MutationRemover( std::shared_ptr graph, c10::optional> mutation_filter = c10::nullopt) : aliasDb_(nullptr), graph_(std::move(graph)) { mutation_filter_ = mutation_filter; } // return true if graph is modified bool removeListMutation(); // return true if graph is modified bool removeTensorMutation(); bool isSpecialMappedOp(Node* n) { return n->matches("aten::zero_(Tensor(a!) self) -> Tensor(a!)") || n->matches( "aten::fill_.Scalar(Tensor(a!) self, Scalar value) -> Tensor(a!)") || n->matches( "aten::normal_(Tensor(a!) self, float mean=0, float std=1, *, Generator? generator=None) -> Tensor(a!)"); } bool inplaceOpVariant(Node* n); static bool hasSideEffectOrAlias(Value* v, AliasDb* aliasDb); private: Node* createSpecialMappedOp(Node* n); bool listMutationFollowingListConstruct(Node* n); bool tryMakeCreationAndMutationAtomic( Value* mutated_value, Node* mutating_op); bool tryMakeUnaliasedIfOutputAndMutationAtomic( Value* mutated_value, Node* mutating_op); // return true if graph is modified bool RemoveListMutation(Block* block); // return true if graph is modified bool RemoveTensorMutation(Block* block); AliasDb* getOrCreateAliasDb() { if (!aliasDb_) { aliasDb_ = std::make_unique(graph_); } return aliasDb_.get(); } c10::optional> mutation_filter_; std::unique_ptr aliasDb_ = nullptr; std::shared_ptr graph_; }; // Removes list mutation with functional equivalents // return true if graph is modified TORCH_API bool RemoveListMutation(const std::shared_ptr& graph); // Replaces in-place aten ops with their functional equivalents // when it can be proven that this does not change graph semantics // if `mutation_filter` is present, the pass will only attempt to // remove mutation on nodes which return true for the filter // return true if graph is modified TORCH_API bool RemoveTensorMutation( const std::shared_ptr& graph, c10::optional> mutation_filter = c10::nullopt); // Replaces in-place aten activation ops with their functional equivalence TORCH_API bool InplaceToFunctionalActivation( const std::shared_ptr& graph); } // namespace jit } // namespace torch