mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-22 19:23:30 +00:00
Fix redundant population of output_indices_ in the execution frame and reserve memory for it in advance. (#375)
This commit is contained in:
parent
82b4ec3d42
commit
61bbf4bfcc
1 changed files with 2 additions and 8 deletions
|
|
@ -338,20 +338,14 @@ void ExecutionFrame::Init(const onnxruntime::GraphViewer& graph,
|
|||
}
|
||||
|
||||
// 4. Handle non-empty output vector
|
||||
// setup output_indices_, we dont' want to generate mem plan on output tensors.
|
||||
for (const auto& oname : output_names) {
|
||||
int mlvalue_idx;
|
||||
Status status = mlvalue_idx_map.GetIdx(oname, mlvalue_idx);
|
||||
ORT_ENFORCE(status.IsOK(), status.ErrorMessage());
|
||||
output_indices_.push_back(mlvalue_idx);
|
||||
}
|
||||
|
||||
if (!fetches.empty()) {
|
||||
// should've already verified this much before when Run() starts
|
||||
ORT_ENFORCE(output_names.size() == fetches.size(),
|
||||
"output_names vector size: " + std::to_string(output_names.size()) +
|
||||
" does not match that of fetches vector: " + std::to_string(fetches.size()));
|
||||
|
||||
// setup output_indices_, we dont' want to generate mem plan on output tensors.
|
||||
output_indices_.reserve(output_names.size());
|
||||
auto idx = 0;
|
||||
for (const auto& oname : output_names) {
|
||||
int mlvalue_idx;
|
||||
|
|
|
|||
Loading…
Reference in a new issue