Fix sign-compare warnings with gcc

This commit is contained in:
Changming Sun 2019-07-24 14:27:29 -07:00
parent 6625eecd09
commit 4ace393bea
3 changed files with 3 additions and 3 deletions

View file

@ -2459,7 +2459,7 @@ Status Graph::SetGraphInputsOutputs() {
// calling private ctor
GSL_SUPPRESS(r .11)
gsl::not_null<Node*> Graph::AllocateNode() {
ORT_ENFORCE(nodes_.size() < std::numeric_limits<int>::max());
ORT_ENFORCE(nodes_.size() < static_cast<unsigned int>(std::numeric_limits<int>::max()));
std::unique_ptr<Node> new_node(new Node(nodes_.size(), *this));
Node* node{new_node.get()};

View file

@ -29,7 +29,7 @@ Status UnsqueezeElimination::Apply(Graph& graph, Node& node, RewriteRuleEffect&
ORT_ENFORCE(tensor_proto);
std::vector<int64_t> new_dims(axes.size() + tensor_proto->dims().size(), 0);
if (new_dims.size() >= std::numeric_limits<int>::max()) {
if (new_dims.size() >= static_cast<unsigned int>(std::numeric_limits<int>::max())) {
return Status(ONNXRUNTIME, FAIL, "index out of range");
}

View file

@ -362,7 +362,7 @@ EXECUTE_RESULT DataRunner::RunTaskImpl(size_t task_id) {
output_names[i] = output_name;
default_allocator->Free(output_name);
}
if (feeds.size() > std::numeric_limits<int>::max()) {
if (feeds.size() > static_cast<unsigned int>(std::numeric_limits<int>::max())) {
ORT_THROW("length overflow");
}
std::vector<const char*> input_names(feeds.size());