/usr/local/lib64/python3.6/site-packages/torch/include/caffe2/opt
NameSizeModeActions
annotations.h21410644editdlrm
backend_cutting.h5860644editdlrm
backend_transformer_base.h27730644editdlrm
bound_shape_inferencer.h58840644editdlrm
converter.h30130644editdlrm
device.h4420644editdlrm
distributed.h11260644editdlrm
fakefp16_transform.h5840644editdlrm
fusion.h41410644editdlrm
glow_net_transform.h16250644editdlrm
mobile.h3880644editdlrm
onnxifi_op.h194970644editdlrm
onnxifi_transformer.h68590644editdlrm
onnx_convert.h12790644editdlrm
optimizer.h4020644editdlrm
optimize_ideep.h3510644editdlrm
passes.h26420644editdlrm
shape_info.h47840644editdlrm
tvm_transformer.h29920644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/caffe2/opt/backend_transformer_base.h (2773B)
#pragma once #include "caffe2/core/common.h" #include "caffe2/core/workspace.h" #include "caffe2/opt/bound_shape_inferencer.h" #include "caffe2/proto/caffe2_pb.h" #include #include #include namespace caffe2 { namespace { constexpr char kNetPos[] = "net_pos"; constexpr char kModelId[] = "model_id"; } // namespace struct BackendTransformOptions { explicit BackendTransformOptions() : bound_shape_spec(0, 0) {} // Enable debugging by dumping more intermediate graphs bool debug{false}; // Minimum number of ops to create a backend op. If the subgraph is too // small, it doesn't make sense to lower it to backend. size_t min_ops{1}; // Bound shape spec BoundShapeSpec bound_shape_spec; }; // Wrap TensorShape into TensorProto TensorProto wrapShapeInfoIntoTensorProto( const std::string& name, const ShapeInfo& shape_info); // Wrap Quantized TensorShape into QTensorProto QTensorProto wrapShapeInfoIntoQTensorProto( const std::string& name, const ShapeInfo& shape_info); // This class contains some common functions for backend lowering and graph // cutting class BackendTransformerBase { public: BackendTransformerBase() {} virtual ~BackendTransformerBase() {} const std::unordered_map& input_mapping() const { return input_mapping_; } const std::unordered_map& reverse_input_mapping() const { return reverse_input_mapping_; } virtual void transform( Workspace* ws, NetDef* pred_net, const std::vector& weight_names, const ShapeInfoMap& shape_hints, const std::unordered_set& blocklisted_ops) = 0; static void annotateOpIndex(NetDef* net); // Get model ID from the NetDef static std::string getModelId(const NetDef& net); protected: // add shape info to the net void addShapeToNet(NetDef& shape_net, const ShapeInfoMap& shape_hints) const; // Dump the net with shape info void dumpNet( const NetDef& pred_net, const ShapeInfoMap& map, const std::string& fname) const; // SSA rewrite the net and return name mapping ShapeInfoMap ssaRewriteAndMapNames( Workspace* ws, NetDef* pred_net, const ShapeInfoMap& input_shape_hints); // Do bound shape inference and collect shape infos ShapeInfoMap inferShapes( Workspace* ws, NetDef* pred_net, const ShapeInfoMap& shape_hints_mapped, const BoundShapeSpec& spec); // Input mapping of input name -> original input name std::unordered_map input_mapping_; // Input mapping of original input name -> input name std::unordered_map reverse_input_mapping_; }; } // namespace caffe2