-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize tensor getitem. #5433
Optimize tensor getitem. #5433
Conversation
a4a90e7
to
bb9b330
Compare
}(); | ||
std::shared_ptr<one::Tensor> result; | ||
if (is_identity) { | ||
result = x; |
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.
这样做的原因是什么呢,PyTorch 里 id(x) == id(x[:])
是 False。如果是想模拟 PyTorch slicing 返回 view 的行为,是不是现在什么都不用做,等到支持了 view 之后这里的行为就自动和 pytorch 一致了
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.
这里是为了做性能优化,但确实可能会给用户造成混淆。我改一下
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.
identity的时候改成copy一把,性能应该会更高一些
48c8d36
to
4c4714a
Compare
…dev_optimize_tensor_getitem
No description provided.