Skip to content

Commit d6d8a60

Browse files
authored
映射文档 No. 18 (#5742)
* 映射文档 No. 18 * Update torch.Tensor.nanquantile.md * Update torch.Tensor.negative.md * Update torch.Tensor.nelement.md * Update torch.Tensor.nonzero.md * Update torch.Tensor.numel.md * Update torch.Tensor.numpy.md * Update torch.Tensor.outer.md * Update torch.Tensor.outer.md * Update torch.Tensor.pow.md * Update torch.Tensor.pow.md * Update torch.Tensor.prod.md * Update torch.Tensor.pin_memory.md * Update torch.Tensor.nanquantile.md * Update torch.Tensor.outer.md * Update torch.Tensor.outer.md * Update torch.Tensor.pow.md * Update torch.Tensor.prod.md * Update torch.Tensor.prod.md * Update torch.Tensor.outer.md * Update torch.Tensor.prod.md * Update torch.Tensor.nanquantile.md * Update torch.Tensor.prod.md * Update torch.Tensor.nanquantile.md * Update torch.Tensor.outer.md * Update torch.Tensor.nanquantile.md * Update torch.Tensor.prod.md * Update torch.Tensor.prod.md * Update torch.Tensor.prod.md * try pre-commit * try again pre-commit * try again again pre-commitpre-commitpre-commit * Update torch.Tensor.nelement.md * Update torch.Tensor.numel.md * Update torch.Tensor.pow.md * Update torch.Tensor.outer.md * Update torch.Tensor.numpy.md * Update torch.Tensor.numpy.md * Update torch.Tensor.outer.md * Update torch.Tensor.pow.md * Update torch.Tensor.pow.md * try pre-commit * Update torch.Tensor.numpy.md * Update torch.Tensor.outer.md * Create torch.Tensor.pow.md * Update torch.Tensor.nelement.md * Update torch.Tensor.numel.md * Update torch.Tensor.nelement.md * Update torch.Tensor.pow.md * Update torch.Tensor.outer.md * Update torch.Tensor.numpy.md
1 parent 3f43c97 commit d6d8a60

10 files changed

+196
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## [ torch 参数更多 ] torch.Tensor.nanquantile
2+
3+
### [torch.Tensor.nanquantile](https://pytorch.org/docs/stable/generated/torch.nanquantile.html#torch.nanquantile)
4+
5+
```python
6+
torch.Tensor.nanquantile(q, dim=None, keepdim=False, *, interpolation='linear')
7+
```
8+
9+
### [paddle.Tensor.nanquantile](https://github.com/PaddlePaddle/Paddle/pull/41343)
10+
11+
```python
12+
paddle.Tensor.nanquantile(q, axis=None, keepdim=False)
13+
```
14+
15+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ------------- | ------------ | ----------------------------------------------------------------------------------- |
21+
| q | q | 一个 [0, 1] 范围内的分位数值的标量或一维张量,仅参数名不一致。 |
22+
| dim | axis | 求乘积运算的维度,仅参数名不一致。 |
23+
| keepdim | keepdim | 是否在输出 Tensor 中保留输入的维度,仅参数名不一致。 |
24+
| interpolation | - | 指定当所需分位数位于两个数据点之间时使用的插值方法,Paddle 无此功能,暂无转写方式。 |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.negative
2+
3+
### [torch.Tensor.negative](https://pytorch.org/docs/stable/generated/torch.negative.html#torch.negative)
4+
5+
```python
6+
torch.Tensor.negative()
7+
```
8+
9+
### [paddle.Tensor.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/neg_cn.html#cn-api-paddle-neg)
10+
11+
```python
12+
paddle.Tensor.neg()
13+
```
14+
15+
两者功能一致,均无参数,用于计算输入 x 的相反数并返回。
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## [ 无参数 ] torch.Tensor.nelement
2+
3+
### [torch.Tensor.nelement](https://pytorch.org/docs/stable/generated/torch.Tensor.nelement.html?highlight=nelement#torch.Tensor.nelement)
4+
5+
```python
6+
torch.Tensor.nelement()
7+
```
8+
9+
### [paddle.Tensor.size](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/fluid/layers/size_cn.html#cn-api-fluid-layers-size)
10+
11+
```python
12+
paddle.Tensor.size()
13+
```
14+
15+
16+
17+
两者功能一致,均无参数,用于返回张量的单元数量,是一个 int 型的整数。
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.nonzero
2+
3+
### [torch.Tensor.nonzero](https://pytorch.org/docs/stable/generated/torch.Tensor.nonzero.html?highlight=nonzero#torch.Tensor.nonzero)
4+
5+
```python
6+
torch.Tensor.nonzero()
7+
```
8+
9+
### [paddle.Tensor.nonzero](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nonzero_cn.html#cn-api-tensor-search-nonzero)
10+
11+
```python
12+
paddle.Tensor.nonzero()
13+
```
14+
15+
两者功能一致,均无参数,用于返回输入 `x` 中非零元素的坐标。
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.numel
2+
3+
### [torch.Tensor.numel](https://pytorch.org/docs/stable/generated/torch.numel.html?highlight=numel#torch.numel)
4+
5+
```python
6+
torch.Tensor.numel()
7+
```
8+
9+
### [paddle.Tensor.size](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/fluid/layers/size_cn.html#cn-api-fluid-layers-size)
10+
11+
```python
12+
paddle.Tensor.size()
13+
```
14+
15+
两者功能一致,均无参数,用于返回张量的单元数量,是一个 int 型的整数。
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## [ torch 参数更多 ] torch.Tensor.numpy
2+
3+
### [torch.Tensor.numpy](https://pytorch.org/docs/stable/generated/torch.Tensor.numpy.html?highlight=numpy#torch.Tensor.numpy)
4+
5+
```python
6+
torch.Tensor.numpy(force=False)
7+
```
8+
9+
### [paddle.Tensor.numpy](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#numpy)
10+
11+
```python
12+
paddle.Tensor.numpy()
13+
```
14+
15+
两者功能一致,用于将当前 Tensor 转化为 numpy.ndarray。
16+
17+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
18+
19+
### 参数映射
20+
21+
| PyTorch | PaddlePaddle | 备注 |
22+
| ------- | ------------ | ---------------------------------------------------------------- |
23+
| force | - | 若 force 为默认,则返回的 ndarray 和 tensor 将共享它们的存储空间 |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## [ 仅参数名不一致 ] torch.Tensor.outer
2+
3+
### [torch.Tensor.outer](https://pytorch.org/docs/stable/generated/torch.Tensor.outer.html?highlight=outer#torch.Tensor.outer)
4+
5+
```python
6+
torch.Tensor.outer(vec2)
7+
```
8+
9+
### [paddle.outer](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/outer_cn.html)
10+
11+
```python
12+
paddle.outer(x, y)
13+
```
14+
15+
两者功能一致,其中 Paddle 相比 Pytorch 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ------- | ------------ | -------------------------------------------------------------------- |
21+
| - | x | 一个 N 维 Tensor 或者标量 Tensor。 |
22+
| vec2 | y | 如果类型是多维 `Tensor`,其数据类型应该和 `x` 相同,仅参数名不一致。 |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## [ 无参数 ] torch.Tensor.pin_memory
2+
3+
### [torch.Tensor.pin_memory](https://pytorch.org/docs/stable/generated/torch.Tensor.pin_memory.html?highlight=pin_mem#torch.Tensor.pin_memory)
4+
5+
```python
6+
torch.Tensor.pin_memory()
7+
```
8+
9+
### [paddle.Tensor.pin_memory](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#pin-memory-y-name-none)
10+
11+
```python
12+
paddle.Tensor.pin_memory()
13+
```
14+
15+
16+
17+
两者功能一致,均无参数,用于将当前 Tensor 的拷贝到固定内存上,且返回的 Tensor 不保留在原计算图中。
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## [ 仅参数名不一致 ] torch.Tensor.pow
2+
3+
### [torch.Tensor.pow](https://pytorch.org/docs/stable/generated/torch.Tensor.pow.html?highlight=pow#torch.Tensor.pow)
4+
5+
```python
6+
torch.Tensor.pow(exponent)
7+
```
8+
9+
### [paddle.pow](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/pow_cn.html)
10+
11+
```python
12+
paddle.pow(x, y)
13+
```
14+
15+
两者功能一致,逐元素计算 x 的 y 次幂。
16+
17+
其中 Paddle 相比 Pytorch 支持更多其他参数,具体如下:
18+
19+
### 参数映射
20+
21+
| PyTorch | PaddlePaddle | 备注 |
22+
| -------- | ------------ | -------------------------------------------------- |
23+
| - | x | 多维 Tensor,数据类型为 float16 、 float32 、 float64 、 int32 或 int64 。 |
24+
| exponent | y | 一个 N 维 Tensor 或者标量 Tensor,仅参数名不一致。 |
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## [ 仅参数名不一致 ] torch.Tensor.prod
2+
3+
### [torch.Tensor.prod](https://pytorch.org/docs/stable/generated/torch.prod.html#torch.prod)
4+
5+
```python
6+
torch.Tensor.prod(dim, keepdim=False, *, dtype=None)
7+
```
8+
9+
### [paddle.Tensor.prod](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/prod_cn.html)
10+
11+
```python
12+
paddle.Tensor.prod(axis=None, keepdim=False, dtype=None, name=None)
13+
```
14+
15+
两者功能一致,仅参数名不一致,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ------- | ------------ | ------------------------------------------------------------- |
21+
| dim | axis | 求乘积运算的维度,仅参数名不一致。 |
22+
| keepdim | keepdim | 是否在输出 Tensor 中保留输入的维度,仅参数名不一致。 |
23+
| dtype | dtype | 输出 Tensor 的数据类型,支持 int32、int64、float32、float64。 |
24+
| - | name | 一般无需设置,默认值为 None。 |

0 commit comments

Comments
 (0)