From ab541e3284464b7d55861188a3dfcf5697c3531c Mon Sep 17 00:00:00 2001 From: liuqi Date: Tue, 12 Sep 2017 15:58:58 +0800 Subject: [PATCH] Fix index compare warning. --- mace/core/operator.h | 2 +- mace/core/tensor.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mace/core/operator.h b/mace/core/operator.h index df488691..4ec4e7b1 100644 --- a/mace/core/operator.h +++ b/mace/core/operator.h @@ -44,7 +44,7 @@ class OperatorBase { *operator_def_, name, default_value); } - inline const Tensor *Input(index_t idx) { + inline const Tensor *Input(unsigned int idx) { MACE_CHECK(idx < inputs_.size()); return inputs_[idx]; } diff --git a/mace/core/tensor.h b/mace/core/tensor.h index 1af32d3f..d40d39d7 100644 --- a/mace/core/tensor.h +++ b/mace/core/tensor.h @@ -68,9 +68,8 @@ class Tensor { inline index_t dim_size() const { return shape_.size(); } - inline index_t dim(index_t index) const { + inline index_t dim(unsigned int index) const { MACE_CHECK(index < shape_.size(), "Exceeding ndim limit"); - MACE_CHECK(index >= 0, "Cannot have negative dimension index"); return shape_[index]; } -- GitLab