From cd0464913fc475b7c3a59d8af861cef9e1c8db9d Mon Sep 17 00:00:00 2001 From: liuqi Date: Mon, 20 Aug 2018 14:55:11 +0800 Subject: [PATCH] Fix benchmark bug when the number of ops is less than 10. --- mace/benchmark/statistics.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mace/benchmark/statistics.cc b/mace/benchmark/statistics.cc index 3de3f4f8..0f05798c 100644 --- a/mace/benchmark/statistics.cc +++ b/mace/benchmark/statistics.cc @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include "mace/benchmark/statistics.h" @@ -151,7 +152,7 @@ std::string OpStat::StatByMetric(const Metric metric, "Stride", "Pad", "Filter Shape", "Output Shape", "Dilation", "name" }; std::vector> data; - int count = top_limit; + int count = std::min(top_limit, static_cast(records.size())); if (top_limit <= 0) count = static_cast(records.size()); int64_t accumulate_time = 0; -- GitLab