/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/tensorexpr
NameSizeModeActions
operators/-0755rm
analysis.h58880644editdlrm
block_codegen.h42110644editdlrm
bounds_inference.h22300644editdlrm
bounds_overlap.h33290644editdlrm
codegen.h64020644editdlrm
cpp_codegen.h22780644editdlrm
cpp_intrinsics.h7190644editdlrm
cuda_codegen.h77820644editdlrm
cuda_random.h26420644editdlrm
dim_arg.h8840644editdlrm
eval.h96390644editdlrm
exceptions.h32530644editdlrm
expr.h115880644editdlrm
external_functions.h12740644editdlrm
external_functions_registry.h23430644editdlrm
fwd_decls.h28060644editdlrm
graph_opt.h25530644editdlrm
half_support.h50380644editdlrm
hash_provider.h79300644editdlrm
intrinsic_symbols.h4200644editdlrm
ir.h226220644editdlrm
ir_cloner.h20690644editdlrm
ir_mutator.h20100644editdlrm
ir_printer.h36930644editdlrm
ir_simplifier.h150900644editdlrm
ir_verifier.h12400644editdlrm
ir_visitor.h18250644editdlrm
kernel.h92100644editdlrm
llvm_codegen.h31800644editdlrm
llvm_jit.h19650644editdlrm
loopnest.h215990644editdlrm
mem_dependency_checker.h130030644editdlrm
reduction.h67420644editdlrm
registerizer.h124980644editdlrm
stmt.h211380644editdlrm
tensor.h76400644editdlrm
tensorexpr_init.h2680644editdlrm
types.h38800644editdlrm
unique_name_manager.h9400644editdlrm
var_substitutor.h17530644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/tensorexpr/graph_opt.h (2553B)
#pragma once #include namespace torch { namespace jit { namespace tensorexpr { // Optimize aten::cat ops in the given subgraph. // // Moving users of cat to its inputs. // Cat ops get lowered into multiple loops, one per input. When the result // of cat is used by some other op, it results in a situation where inlining // of cat does not happen. This in turn results in intermediate buffers // being created for the result of cat, since it is not inlined. // // For example, consider the following graph: // graph(%x : Float(10, strides=[1], device=cpu), // %y : Float(20, strides=[1], device=cpu)): // %dim : int = prim::Constant[value=0]() // %xy_list : Tensor[] = prim::ListConstruct(%x, %y) // %cat : Float(60, strides=[1], device=cpu) = aten::cat(%xy_list, %dim) // %5 : Float(60, strides=[1], device=cpu) = aten::log(%cat) // return (%5))IR"; // // This will get lowered into: // Allocate(aten_cat); // for (...) // aten_cat[...] = x[...] // for (...) // aten_cat[...] = y[...] // for (...) // aten_log[...] = log(aten_cat[...]) // Free(aten_cat); // Note that aten_cat is not inlined into aten_log and it results in // an intermediate buffer allocation as well. // // Optimization: // We move the ops that use the result of `cat` into its inputs whenever // possible. // // The graph above will be transformed to: // graph(%x : Float(10, strides=[1], device=cpu), // %y : Float(20, strides=[1], device=cpu)): // %3 : int = prim::Constant[value=0]() // %7 : Float(10, strides=[1], device=cpu) = aten::log(%x) // %8 : Float(20, strides=[1], device=cpu) = aten::log(%y) // %9 : Tensor[] = prim::ListConstruct(%7, %8) // %10 : Float(60, strides=[1], device=cpu) = aten::cat(%9, %3) // return (%10) // // This will get lowered into: // for (...) // aten_cat[...] = log(x[...]) // for (...) // aten_cat[...] = log(y[...]) // aten_cat is the output buffer here. bool OptimizeCat(const std::shared_ptr& graph); TORCH_API void annotateInputShapes( const std::shared_ptr& graph, const std::vector>& example_inputs); TORCH_API std::shared_ptr removeUnusedSelfArgument( const std::shared_ptr& graph); } // namespace tensorexpr } // namespace jit } // namespace torch