Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yuslepukhin committed Dec 19, 2024
1 parent 9837a8d commit 153592b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/onnxruntime/core/graph/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ class Graph { // NOLINT(clang-analyzer-optin.performance.Padding): preserve exi
/// <param name="external_stream">external file stream</param>
/// <param name="external_offset">current external file offset updated with each write</param>
/// <returns>Status instance</returns>
Status ToGraphProtoWithExternalInitiallizersImpl(
Status AddExternalInitializersToGraphProtoImpl(
const std::filesystem::path& model_path,
const std::filesystem::path& external_file_path,
const std::filesystem::path& model_external_file_path,
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/core/framework/prepacked_weights_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ const PrePackedWeights* PrepackedWeightsForGraph::GetPrepackedWeights(const std:
std::optional<PrePackedWeights> PrepackedWeightsForGraph::ReplaceWithReferenceIfSaving(
const std::string& weight_name,
const std::string& key,

Check warning on line 89 in onnxruntime/core/framework/prepacked_weights_container.cc

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Add #include <string> for string [build/include_what_you_use] [4] Raw Output: onnxruntime/core/framework/prepacked_weights_container.cc:89: Add #include <string> for string [build/include_what_you_use] [4]
const PrePackedWeights& refer_if_absent) {
const PrePackedWeights& refer_to_if_absent) {
auto it = key_to_blobs_.find(key);
if (it == key_to_blobs_.end()) {
if (save_mode_on_) {
key_to_blobs_.emplace(key, refer_if_absent.CreateReferringCopy());
key_to_blobs_.emplace(key, refer_to_if_absent.CreateReferringCopy());
weight_prepacks_for_saving_[weight_name].insert(key);
}
return std::nullopt;
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/framework/prepacked_weights_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class PrepackedWeightsForGraph {
// the container.
std::optional<PrePackedWeights> ReplaceWithReferenceIfSaving(const std::string& weight_name,
const std::string& key,
const PrePackedWeights& refer_if_absent);
const PrePackedWeights& refer_to_if_absent);

bool IsSaveModeOn() const noexcept {
return save_mode_on_;
Expand Down
12 changes: 6 additions & 6 deletions onnxruntime/core/graph/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4097,7 +4097,7 @@ ONNX_NAMESPACE::GraphProto Graph::ToGraphProto() const {
return result;
}

Status Graph::ToGraphProtoWithExternalInitiallizersImpl(
Status Graph::AddExternalInitializersToGraphProtoImpl(
const std::filesystem::path& model_path,
const std::filesystem::path& external_file_path,
const std::filesystem::path& model_external_file_path,
Expand Down Expand Up @@ -4134,7 +4134,7 @@ Status Graph::ToGraphProtoWithExternalInitiallizersImpl(
"Subgraph ", name, " is referred to in GetAttributeNameToSubgraphMap, but not found in node ",
node.Name(), " while attempting to recurse into it.");
auto& result_subgraph = *sub_hit->mutable_g();
ORT_RETURN_IF_ERROR(subgraph->ToGraphProtoWithExternalInitiallizersImpl(
ORT_RETURN_IF_ERROR(subgraph->AddExternalInitializersToGraphProtoImpl(
model_path, external_file_path,
model_external_file_path, model_saving_options,
result_subgraph,
Expand Down Expand Up @@ -4261,10 +4261,10 @@ ONNX_NAMESPACE::GraphProto Graph::ToGraphProtoWithExternalInitializers(
ORT_ENFORCE(external_stream.is_open(), "Failed to open for writing:", modified_external_file_path);
int64_t external_offset = 0;

ORT_THROW_IF_ERROR(ToGraphProtoWithExternalInitiallizersImpl(model_path, external_file_path,
modified_external_file_path, model_saving_options,
result,
external_stream, external_offset));
ORT_THROW_IF_ERROR(AddExternalInitializersToGraphProtoImpl(model_path, external_file_path,
modified_external_file_path, model_saving_options,
result,
external_stream, external_offset));

if (!external_stream.flush()) {
ORT_THROW("Failed to flush file with external initializers: ", modified_external_file_path);
Expand Down

0 comments on commit 153592b

Please sign in to comment.