diff --git a/onnxruntime/core/framework/node_index_info.cc b/onnxruntime/core/framework/node_index_info.cc index 4063d0104f..502568f41c 100644 --- a/onnxruntime/core/framework/node_index_info.cc +++ b/onnxruntime/core/framework/node_index_info.cc @@ -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. diff --git a/onnxruntime/core/providers/cpu/tensor/scatter_nd.cc b/onnxruntime/core/providers/cpu/tensor/scatter_nd.cc index 9b1b173c43..d703568549 100644 --- a/onnxruntime/core/providers/cpu/tensor/scatter_nd.cc +++ b/onnxruntime/core/providers/cpu/tensor/scatter_nd.cc @@ -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 \ No newline at end of file +} // namespace onnxruntime