Fix two compiler warnings (#4263)

This commit is contained in:
Changming Sun 2020-06-17 20:47:01 -07:00 committed by GitHub
parent 5d773ee57b
commit e505faa022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -32,7 +32,8 @@ static void FindMinAndMaxNodeIndex(const TValidNodes& nodes, NodeIndex& min, Nod
std::for_each(nodes.cbegin(), nodes.cend(), [&min, &max](const Node& node) {
auto idx = node.Index();
if (idx > max) max = idx;
if (idx >= 0 && idx < min) min = idx;
//NodeIndex is size_t type
if (idx < min) min = idx;
});
// match GraphViewer::MaxNodeIndex() which returns nodes_.size(), so is actually the max used value + 1.

View file

@ -45,8 +45,8 @@ Status ScatterNDBase::PrepareForCompute(OpKernelContext* context, Prepare& p) co
if (update_rank < indice_rank - 1) {
return true;
}
if ((update_rank >= indice_rank - 1) &&
(indice_rank - 1 >= 0) &&
if (update_rank >= indice_rank - 1 &&
indice_rank >= 1 &&
(indice_shape.Slice(0, indice_rank - 1) != update_shape.Slice(0, indice_rank - 1))) {
return true;
}
@ -154,4 +154,4 @@ Status ScatterND::ScatterString(const Prepare& p, concurrency::ThreadPool* tp) c
return Status::OK();
}
} // namespace onnxruntime
} // namespace onnxruntime