MKL-DNN EP: control flow fix (#1740)

* moved subgraph_index to MklDnn Execution Provider

* code cleanup
This commit is contained in:
Sreekanth Yalachigere 2019-08-31 09:58:59 -07:00 committed by jywu-msft
parent 259863758e
commit f4a6d267c1
3 changed files with 6 additions and 8 deletions

View file

@ -357,8 +357,8 @@ void MKLDNNExecutionProvider::CreateMetaDef(const onnxruntime::GraphViewer& grap
std::vector<std::unique_ptr<ComputeCapability>>& result) const {
std::string graph_fused_nodes;
std::string node_list;
std::string subgraph_id = std::to_string(sub_var.subgraph_index);
sub_var.subgraph_index++;
std::string subgraph_id = std::to_string(subgraph_index_);
subgraph_index_++;
// This is a list of initializers that subgraph considers as constants.
// Example weights, reshape shape etc.
@ -378,7 +378,7 @@ void MKLDNNExecutionProvider::CreateMetaDef(const onnxruntime::GraphViewer& grap
auto meta_def = std::make_unique<::onnxruntime::IndexedSubGraph::MetaDef>();
meta_def->attributes["initializers"] = initializers;
meta_def->name = "MkldnnCustomOp" + std::to_string(sub_var.subgraph_index);
meta_def->name = "MkldnnCustomOp" + std::to_string(subgraph_index_);
meta_def->domain = kMSDomain;
meta_def->since_version = 1;
meta_def->status = ONNX_NAMESPACE::EXPERIMENTAL;

View file

@ -147,6 +147,8 @@ class MKLDNNExecutionProvider : public IExecutionProvider {
}
private:
mutable int subgraph_index_ = 0;
// supported MklDnn Operators
std::set<std::string> mkldnn_ops_ = {"Conv", "BatchNormalization", "Relu", "Sum",
"AveragePool", "GlobalMaxPool", "GlobalAveragePool", "MaxPool", "LRN"};

View file

@ -48,12 +48,8 @@ struct Subgraph {
std::vector<std::string> outputs;
std::vector<std::string> outputs_as_input_other_node;
std::vector<onnxruntime::NodeIndex> subgraph_node_indexes;
int subgraph_index = 0;
SubgraphVariables() {
subgraph_index = 0;
}
void Reset() {
void Reset() {
subgraph_node_indexes.clear();
inputs.clear();
outputs.clear();