Skip to content
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

Add paddle::Tensor::slice guides doc #3824

Merged
merged 2 commits into from
Aug 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/guides/07_new_op/new_custom_op_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ std::vector<paddle::Tensor> OpFucntion(const paddle::Tensor& x, ..., int attr, .
- 模板类方法,获取数据内存的起始地址(只读访问)
- `template <typename T> T* mutable_data(const PlaceType& place)`:
- 模板类方法,输入参数 `place` ,根据 `Tensor.shape` 在指定设备上申请内存,并返回内存的起始地址
- `Tensor slice(const int64_t begin_idx, const int64_t end_idx) const`:
- 输入参数起始行 `begin_idx` 和终止行 `end_idx`,返回当前 `Tensor` 从起始行(含)到终止行(不含)的一个视图
> 注:本API仅支持对当前 `Tensor` 的第一个维度(即 axis = 0)进行切分
- 工具类API:
- `template <typename T> Tensor copy_to(const PlaceType& place) const`:
- 模板类方法,输入参数 `place`,将当前 `Tensor` 拷贝到指定设备上并返回
Expand Down