-
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
Use cpu for slice boxing if device is not cpu and cuda #8180
Use cpu for slice boxing if device is not cpu and cuda #8180
Conversation
…use_cpu_for_slice_boxing_if_device_is_not_cpu_and_cuda
…use_cpu_for_slice_boxing_if_device_is_not_cpu_and_cuda
… of https://github.com/Oneflow-Inc/oneflow into use_cpu_for_slice_boxing_if_device_is_not_cpu_and_cuda
template<Maybe<one::Tensor> (*func)(const std::shared_ptr<one::Tensor>&, Symbol<PlacedNdSbp>, | ||
Symbol<PlacedNdSbp>)> |
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.
这里template<typename func>
就行
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.
这里
template<typename func>
就行
template<typename func>
的话需要Func作为变量作为输入参数,上面写法可以将一个函数指针作为特化值,二者还是有一定的区别
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.
我是说template会更简单一些,不一定需要将Func作为输入参数,你可以写成template<typename Func, Func* func>
,func的类型自动推导,写起来会更简单一些
View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/8180/ |
修改 eager slice boxing计算图,当tensor的设备类型既不是cpu又不是cuda时,将tensor 拷贝到cpu上,在cpu上做boxing,然后在结果拷回到对应的设备上。此pr为添加一种新的设备类型时,提供最基本的eager boxing 支持