diff --git a/onnxruntime/core/framework/kernel_def_builder.cc b/onnxruntime/core/framework/kernel_def_builder.cc index 6270e30d3e..9aa8ecf787 100644 --- a/onnxruntime/core/framework/kernel_def_builder.cc +++ b/onnxruntime/core/framework/kernel_def_builder.cc @@ -15,7 +15,7 @@ inline bool AreIntervalsOverlap(int start1, int end1, int start2, int end2) { template inline bool AreVectorsOverlap(const std::vector& v1, const std::vector& v2) { - for (T type : v1) { + for (const T& type : v1) { if (std::find(v2.begin(), v2.end(), type) != v2.end()) { return true; } @@ -44,7 +44,7 @@ bool KernelDef::IsConflict(const KernelDef& other) const { //only one case they don't conflict: //There is a type_constraint, it exists in both hands, but they don't overlap //check types - auto other_types = other.TypeConstraints(); + const auto& other_types = other.TypeConstraints(); bool type_has_conflict = true; for (const auto& it : type_constraints_) { auto iter = other_types.find(it.first); diff --git a/onnxruntime/core/graph/model.cc b/onnxruntime/core/graph/model.cc index 24f45250eb..f88427b5e9 100644 --- a/onnxruntime/core/graph/model.cc +++ b/onnxruntime/core/graph/model.cc @@ -26,8 +26,6 @@ using namespace ONNX_NAMESPACE; using namespace onnxruntime; using namespace onnxruntime::common; -static constexpr int protobuf_block_size_in_bytes = 4 * 1024 * 1024; - namespace onnxruntime { Model::Model(const std::string& graph_name, bool is_onnx_domain_only, @@ -239,7 +237,7 @@ Status Model::Load(std::istream& model_istream, ModelProto* p_model_proto) { if (!p_model_proto) { return Status(ONNXRUNTIME, INVALID_ARGUMENT, "Null model_proto ptr."); } - google::protobuf::io::IstreamInputStream zero_copy_input(&model_istream, protobuf_block_size_in_bytes); + google::protobuf::io::IstreamInputStream zero_copy_input(&model_istream); const bool result = p_model_proto->ParseFromZeroCopyStream(&zero_copy_input) && model_istream.eof(); if (!result) { return Status(ONNXRUNTIME, INVALID_PROTOBUF, "Failed to load model because protobuf parsing failed."); @@ -449,7 +447,7 @@ Status Model::Load(int fd, ONNX_NAMESPACE::ModelProto& model_proto) { } #if GOOGLE_PROTOBUF_VERSION >= 3002000 - FileInputStream input(fd, protobuf_block_size_in_bytes); + FileInputStream input(fd); const bool result = model_proto.ParseFromZeroCopyStream(&input) && input.GetErrno() == 0; if (!result) { return Status(ONNXRUNTIME, INVALID_PROTOBUF, "Protobuf parsing failed.");