Skip to content

Commit 6c6a353

Browse files
Jokerenfacebook-github-bot
authored andcommitted
Fix speedbenchmark bug (pytorch#9770)
Summary: Pull Request resolved: pytorch#9770 Add zero ops to operators that do not have a valid schema Reviewed By: hlu1 Differential Revision: D8957472 fbshipit-source-id: d8d0a351183e88ace2e050a87c1e1c363af67e33
1 parent d7d673b commit 6c6a353

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

caffe2/core/net_simple.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ vector<float> SimpleNet::TEST_Benchmark(
162162
memory_bytes_read_per_op_type[op_type] += cost.bytes_read;
163163
memory_bytes_written_per_op_type[op_type] += cost.bytes_written;
164164
param_bytes_per_op_type[op_type] += cost.params_bytes;
165+
} else {
166+
flops_per_op.emplace_back(0);
167+
memory_bytes_read_per_op.emplace_back(0);
168+
memory_bytes_written_per_op.emplace_back(0);
169+
param_bytes_per_op.emplace_back(0);
165170
}
166171
}
167172
timer.Start();
@@ -189,7 +194,9 @@ vector<float> SimpleNet::TEST_Benchmark(
189194
std::stringstream flops_str;
190195
if (idx < flops_per_op.size() && flops_per_op[idx]) {
191196
flops_str << " (" << to_string(1.0e-9 * flops_per_op[idx]) << " GFLOP, "
192-
<< to_string(1.0e-6 * flops_per_op[idx] / time_per_op[idx])
197+
<< to_string(
198+
1.0e-6 * flops_per_op[idx] / time_per_op[idx] *
199+
main_runs)
193200
<< " GFLOPS)";
194201
}
195202
std::stringstream memory_bytes_read_str;

0 commit comments

Comments
 (0)