Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Commit 3e475f9

Browse files
committed
fix examples
Signed-off-by: Hui Zhang <zhtclz@foxmail.com>
1 parent d48b813 commit 3e475f9

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

gcompiler/example/c++/basic/perf.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Status InitializeSession(int num_threads, const string& graph,
140140
LOG(INFO) << "Loading TensorFlow.";
141141

142142
tensorflow::SessionOptions options;
143-
// set thread pool
143+
//// set thread pool
144144
tensorflow::ConfigProto& config = options.config;
145145
config.mutable_gpu_options()->set_allow_growth(true);
146146
// config.mutable_gpu_options()->set_per_process_gpu_memory_fraction(0.5);
@@ -158,9 +158,9 @@ Status InitializeSession(int num_threads, const string& graph,
158158
graph_optimizer->set_name("SubGraphFusionOptimizer");*/
159159

160160
LOG(INFO) << "Got config, " << config.device_count_size() << " devices";
161-
162161
session->reset(tensorflow::NewSession(options));
163162
graph_def->reset(new GraphDef());
163+
LOG(INFO) << "new session ok!";
164164
// tensorflow::GraphDef tensorflow_graph;
165165
//Status s = ReadBinaryProto(Env::Default(), graph, graph_def->get());
166166
//if (!s.ok()) {

gcompiler/example/c++/benchmark.cc

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ namespace tensorflow {
1414

1515
void perf_of_inference() {
1616
Perf::Config cfg;
17-
cfg.graph =
18-
"/tmp-data/test/self/delta_infer/delta_infer/example/python/result.pb";
19-
20-
cfg.input_layer = "Placeholder:0,Placeholder_1:0";
21-
22-
cfg.input_layer_shape = "1,100,768:1,100,100";
23-
cfg.input_layer_type = "float,int32";
24-
cfg.input_layer_values = "1,1";
25-
cfg.output_layer =
26-
"import/e2e_model/Model_1/attn_decoder/LASDecoder/decoding_output:0";
17+
//cfg.graph = "/tmp-data/test/self/delta_infer/delta_infer/example/python/result.pb";
18+
cfg.graph = "/nfs/project/gaoyonghu/tf-inference-lib/unit_test/crash/models/frozen_graph_crash.pb";
19+
20+
//cfg.input_layer = "Placeholder:0,Placeholder_1:0";
21+
cfg.input_layer = "inputs:0";
22+
23+
//cfg.input_layer_shape = "1,100,768:1,100,100";
24+
cfg.input_layer_shape = "32,1000,40,1";
25+
//cfg.input_layer_type = "float,int32";
26+
cfg.input_layer_type = "float";
27+
//cfg.input_layer_values = "1,1";
28+
cfg.input_layer_values = "";
29+
//cfg.output_layer = "import/e2e_model/Model_1/attn_decoder/LASDecoder/decoding_output:0";
30+
cfg.output_layer = "softmax_output:0";
2731
cfg.target_layer = "";
2832
cfg.num_threads = 1;
2933
Perf infer(&cfg);

gcompiler/example/c++/gemm_perf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int main(int argc, const char** argv) {
2929
if (argc < 5) {
3030
fprintf(
3131
stderr,
32-
"ERROR: need paramter batch_size, seq_len, head_num, size_per_head");
32+
"ERROR: need paramter batch_size, seq_len, head_num, size_per_head\n");
3333
exit(1);
3434
}
3535

gcompiler/example/c++/perf_test.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ int main(int argc, const char** argv) {
6464
// tensorflow::test(fd);
6565
std::vector<int> batchs{4, 8, 16, 32, 64, 128};
6666
std::vector<int> seqs{50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
67+
if (argc != 3){
68+
LOG(INFO) << "usage: bin <graph-path> <batch-size>";
69+
exit(1);
70+
}
6771
const char* graph = argv[1];
6872
int batch = atoi(argv[2]);
6973
// for(auto btid : batchs) {

0 commit comments

Comments
 (0)