Replace Clone() with View() (#432)

Co-authored-by: hiedean <hiedean@tju.edu.cn>
This commit is contained in:
HieDean
2023-11-20 09:20:50 +08:00
committed by GitHub
parent ac00edab5b
commit e6a2d0da3b
5 changed files with 14 additions and 12 deletions

View File

@@ -67,13 +67,13 @@ class OnlineRnnLM::Impl {
return {std::move(out[0]), std::move(next_states)};
}
std::pair<Ort::Value, std::vector<Ort::Value>> GetInitStates() const {
std::pair<Ort::Value, std::vector<Ort::Value>> GetInitStates() {
std::vector<Ort::Value> ans;
ans.reserve(init_states_.size());
for (const auto &s : init_states_) {
ans.emplace_back(Clone(allocator_, &s));
for (auto &s : init_states_) {
ans.emplace_back(View(&s));
}
return {std::move(Clone(allocator_, &init_scores_.value)), std::move(ans)};
return {View(&init_scores_.value), std::move(ans)};
}
private: