-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Replace Clone() with View() #432
Conversation
There are also other occurrences of sherpa-onnx/sherpa-onnx/csrc/online-wenet-ctc-model.cc Lines 111 to 112 in 1a6a41e
The returned states are inputs to the neural network and won't be changed by the callers, so sharing the memory with |
By the way,please fix the code stle issues You can check the code style locally by running cd /path/to/sherpa-onnx
./scripts/check_style_cpplint.sh 2 |
3467c5b
to
c6acdc0
Compare
Follow your guide and make changes. |
For sherpa-onnx/sherpa-onnx/csrc/online-wenet-ctc-model.cc Lines 111 to 112 in 1a6a41e
I leave them unchaged. I am not sure using View() in GetInitStates() is a good idea, because GetInitStates() is designed to have no right to modify member variables.
|
Thanks!
Please change
to
by removing the trailing If the CI passes, then it is safe to use |
c6acdc0
to
83d0bc0
Compare
@@ -250,7 +250,7 @@ Ort::Value OnlineLstmTransducerModel::RunDecoder(Ort::Value decoder_input) { | |||
Ort::Value OnlineLstmTransducerModel::RunJoiner(Ort::Value encoder_out, | |||
Ort::Value decoder_out) { | |||
std::array<Ort::Value, 2> joiner_input = {std::move(encoder_out), | |||
std::move(decoder_out)}; | |||
View(&decoder_out)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, we don't need to replace move
with View
.
sherpa-onnx/csrc/online-rnn-lm.cc
Outdated
} | ||
return {std::move(Clone(allocator_, &init_scores_.value)), std::move(ans)}; | ||
return {std::move(View(&init_scores_.value)), std::move(ans)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return {std::move(View(&init_scores_.value)), std::move(ans)}; | |
return {View(&init_scores_.value), std::move(ans)}; |
83d0bc0
to
56ad64e
Compare
Thank you for your contribution! |
Thank you for your guidance! I feel very happy that I can contribute to the community. And I have learned a lot during PR. |
Co-authored-by: hiedean <hiedean@tju.edu.cn>
Replace
Clone()
withView()