ngraph-bridge
ngraph-bridge copied to clipboard
How to run tensorflow benchmark_model through ngraph cpu
HI ALL, I want to run TF benchmark_model through ngraph cpu, is there some doc to guide me do these?
I have try to load libngraph_bridge.so manually in benchmark_model.cc like below:
TF_LoadLibrary(
"libngraph_bridge.so",
status);
and add customize_config into SessionOptions refer UT
tensorflow::SessionOptions options;
options.config.mutable_graph_options()
->mutable_optimizer_options()
->set_opt_level(tensorflow::OptimizerOptions_Level_L0);
options.config.mutable_graph_options()
->mutable_rewrite_options()
->set_constant_folding(tensorflow::RewriterConfig::OFF);
tensorflow::ConfigProto& config = options.config;
auto* custom_config = options.config.mutable_graph_options()
->mutable_rewrite_options()
->add_custom_optimizers();
custom_config->set_name("ngraph-optimizer");
(*custom_config->mutable_parameter_map())["ngraph_backend"].set_s("CPU");
(*custom_config->mutable_parameter_map())["device_id"].set_s("0");
options.config.mutable_graph_options()
->mutable_rewrite_options()
->set_min_graph_nodes(-1);
options.config.mutable_graph_options()
->mutable_rewrite_options()
->set_meta_optimizer_iterations(tensorflow::RewriterConfig::ONE);
config.set_allow_soft_placement(true);
LOG(INFO) << "Got config, " << config.device_count_size() << " devices";
session->reset(tensorflow::NewSession(options));
graph_def->reset(new GraphDef());
tensorflow::GraphDef tensorflow_graph;
Status s = ReadBinaryProto(Env::Default(), graph, graph_def->get());
but these does not work!