diff --git a/mace/benchmark/statistics.cc b/mace/benchmark/statistics.cc index 3de3f4f89bd9286ed0ef35eda30e8794ba5d6014..0f05798c9881660ee59e19600bd045b315472d37 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;