Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fajin-corp committed Jul 30, 2024
1 parent 20f6cea commit f3a456f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions onnxruntime/core/framework/session_state_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,12 @@ common::Status SaveInitializedTensors(
bool use_device_allocator_for_initializers =
session_options.config_options.GetConfigOrDefault(kOrtSessionOptionsUseDeviceAllocatorForInitializers, "0") == "1";

Tensor* p_tensor = buffered_tensors.find(name) != buffered_tensors.end()
? buffered_tensors[name].release()
: nullptr;
Tensor* p_tensor = nullptr;
if (auto iter = buffered_tensors.find(name);
iter != buffered_tensors.end()) {
p_tensor = iter->second.release();
buffered_tensors.erase(iter);
}

Status st = DeserializeTensorProto(env, graph_loc, tensor_proto, (m.has_value()) ? &*m : nullptr, alloc,
default_cpu_alloc, ort_value, data_transfer_mgr,
Expand Down

0 comments on commit f3a456f

Please sign in to comment.