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

映射文档 No 7~10 #5727

Merged
merged 8 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [ 无参数 ]torch.Tensor.arccosh

### [torch.Tensor.arccosh](https://pytorch.org/docs/stable/generated/torch.Tensor.arccosh.html?highlight=arccosh#torch.Tensor.arccosh)

```python
torch.Tensor.arccosh()
```

### [paddle.Tensor.acosh](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/acosh_cn.html#acosh)

```python
paddle.Tensor.acosh(name=None)
```

两者功能完全一致,无参数。
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## [ torch 参数更多 ]torch.Tensor.cpu

### [torch.Tensor.cpu](https://pytorch.org/docs/stable/generated/torch.Tensor.cpu.html?highlight=torch+tensor+cpu#torch.Tensor.cpu)

```python
torch.Tensor.cpu(memory_format=torch.preserve_format)
```

### [paddle.Tensor.cpu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#cpu)

```python
paddle.Tensor.cpu()
```

两者功能一致,其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
| memory_format=torch.preserve_format | - | 表示内存格式,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## [ 仅参数名不一致 ]torch.Tensor.cross

### [torch.Tensor.cross](https://pytorch.org/docs/stable/generated/torch.Tensor.cross.html?highlight=cross#torch.Tensor.cross)

```python
torch.Tensor.cross(other, dim=None)
```

### [paddle.Tensor.cross](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#cross-y-axis-none-name-none)

```python
paddle.Tensor.cross(y, axis=None, name=None)
```

两者功能一致且参数用法一致,仅参数名不同,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | -------------------------------------- |
| other | y | 输入 Tensor,仅参数名不同。 |
| dim | axis | 沿此维度进行向量积操作,仅参数名不同。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## [ 参数完全一致 ]torch.Tensor.cumprod

### [torch.Tensor.cumprod](https://pytorch.org/docs/stable/generated/torch.Tensor.cumprod.html?highlight=cumprod#torch.Tensor.cumprod)

```python
torch.Tensor.cumprod(dim, dtype=None)
```

### [paddle.Tensor.cumprod](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/cumprod_cn.html#cumprod)

```python
paddle.Tensor.cumprod(dim=None, dtype=None, name=None)
```

两者功能一致且参数用法一致, 具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
| dim | dim | 指明需要累乘的维度。 |
| dtype | dtype | 返回张量所需的数据类型。dtype 如果指定,则在执行操作之前将输入张量转换为指定的 dtype,这对于防止数据类型溢出很有用。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## [ 仅参数名不一致 ]torch.Tensor.cumsum

### [torch.Tensor.cumsum](https://pytorch.org/docs/stable/generated/torch.Tensor.cumsum.html?highlight=cumsum#torch.Tensor.cumsum)

```python
torch.Tensor.cumsum(dim, dtype=None)
```

### [paddle.Tensor.cumsum](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#cumsum-axis-none-dtype-none-name-none)

```python
paddle.Tensor.cumsum(axis=None, dtype=None, name=None)
```

两者功能一致且参数用法一致,仅参数名不同,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ------------------------------ |
| dim | axis | 需要累加的维度,仅参数名不同。 |
| dtype | dtype | 输出 Tensor 的数据类型。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [ 无参数 ]torch.Tensor.deg2rad

### [torch.Tensor.deg2rad](https://pytorch.org/docs/stable/generated/torch.Tensor.deg2rad.html?highlight=deg2rad#torch.Tensor.deg2rad)

```python
torch.Tensor.deg2rad()
```

### [paddle.Tensor.deg2rad](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#deg2rad-x-name-none)

```python
paddle.Tensor.deg2rad(name=None)
```

两者功能完全一致,无参数。
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## [ 参数完全一致 ]torch.Tensor.det

### [torch.Tensor.det](https://pytorch.org/docs/stable/generated/torch.Tensor.det.html?highlight=det#torch.Tensor.det)

```python
torch.Tensor.det()
```

### [paddle.linalg.det](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/det_cn.html#det)

```python
paddle.linalg.det(x)
```

两者功能参数完全一致,其中 `paddle.linalg.det(x)` 是类成员函数转成非类成员函数,因此输入参数 `x` 不进行对比,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ---------------------------------------------------------------------------------------- |
| - | x | 输入一个或批量矩阵。x 的形状应为 [*, M, M],其中 * 为零或更大的批次维度,仅参数名不同。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [ 无参数 ]torch.Tensor.detach

### [torch.Tensor.detach](https://pytorch.org/docs/stable/generated/torch.Tensor.detach.html?highlight=detach#torch.Tensor.detach)

```python
torch.Tensor.detach()
```

### [paddle.Tensor.detach](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#detach)

```python
paddle.Tensor.detach()
```

两者功能完全一致,无参数。
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [ 仅参数名不一致 ]torch.Tensor.diag

### [torch.Tensor.diag](https://pytorch.org/docs/stable/generated/torch.Tensor.diag.html?highlight=diag#torch.Tensor.diag)

```python
torch.Tensor.diag(diagonal=0)
```

### [paddle.Tensor.diag](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/diag_cn.html#diag)

```python
paddle.diag(x, offset=0, padding_value=0, name=None)
```

两者功能一致,仅参数名不一致,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| -------- | ------------- | -------------------------------------------------------------------------------------- |
| - | x | 输入的 Tensor,paddle 参数更多。 |
| diagonal | offset | 考虑的对角线:正值表示上对角线,0 表示主对角线,负值表示下对角线,仅参数名不同。 |
| - | padding_value | 使用此值来填充指定对角线以外的区域,仅在输入为一维 Tensor 时生效,默认值为 0。torch 无此参数,paddle 保持默认即可。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## [ 参数完全一致 ]torch.Tensor.diagflat

### [torch.Tensor.diagflat](https://pytorch.org/docs/stable/generated/torch.Tensor.diagflat.html?highlight=diagflat#torch.Tensor.diagflat)

```python
torch.Tensor.diagflat(offset=0)
```

### [paddle.Tensor.diagflat](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/diagflat_cn.html#diagflat)

```python
paddle.diagflat(x, offset=0, name=None)
```

两者功能参数完全一致,其中 `paddle.Tensor.diagflat(x)` 是类成员函数转成非类成员函数,因此输入参数 `x` 不进行对比,具体如下:
Ainavo marked this conversation as resolved.
Show resolved Hide resolved

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ------------------------------------------------------------------ |
| - | x | 输入的 Tensor,仅参数名不同。 |
Ainavo marked this conversation as resolved.
Show resolved Hide resolved
| offset | offset | 对角线偏移量。正值表示上对角线,0 表示主对角线,负值表示下对角线。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [ 仅参数名不一致 ]torch.Tensor.diagonal

### [torch.Tensor.diagonal](https://pytorch.org/docs/stable/generated/torch.Tensor.diagonal.html?highlight=diagonal#torch.Tensor.diagonal)

```python
torch.Tensor.diagonal(offset=0, dim1=0, dim2=1)
```

### [paddle.Tensor.diagonal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#diagonal-offset-0-axis1-0-axis2-1-name-none)

```python
paddle.Tensor.diagonal(offset=0, axis1=0, axis2=1, name=None)
```

两者功能一致且参数用法一致,仅参数名不同,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | -------------------------------------------------------------------------- |
| offset | offset | 从指定的二维平面中获取对角线的位置,默认值为 0,既主对角线,仅参数名不同。 |
| dim1 | axis1 | 获取对角线的二维平面的第一维,默认值为 0,仅参数名不同。 |
| dim2 | axis2 | 获取对角线的二维平面的第二维,默认值为 1,仅参数名不同。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## [ 仅参数名不一致 ]torch.Tensor.diff

### [torch.Tensor.diff](https://pytorch.org/docs/stable/generated/torch.Tensor.diff.html?highlight=diff#torch.Tensor.diff)

```python
torch.Tensor.diff(n=1, dim=- 1, prepend=None, append=None)
```

### [paddle.Tensor.diff](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/diff_cn.html#diff)

```python
paddle.Tensor.diff(n=1, axis=-1, prepend=None, append=None, name=None)
```

两者功能一致且参数用法一致,仅参数名不同,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| n | n | 需要计算前向差值的次数,目前仅支持 n=1,默认值为 1。 |
| dim | axis | 沿着哪一维度计算前向差值,默认值为-1,也即最后一个维度,仅参数名不同。 |
| prepend | prepend | 在计算前向差值之前,沿着指定维度 axis 附加到输入 x 的前面,它的维度需要和输入一致,并且除了 axis 维外,其他维度的形状也要和输入一致,默认值为 None。 |
| append | append | 在计算前向差值之前,沿着指定维度 axis 附加到输入 x 的后面,它的维度需要和输入一致,并且除了 axis 维外,其他维度的形状也要和输入一致,默认值为 None。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [ 无参数 ]torch.Tensor.digamma

### [torch.Tensor.digamma](https://pytorch.org/docs/stable/generated/torch.Tensor.digamma.html?highlight=digamma#torch.Tensor.digamma)

```python
torch.Tensor.digamma()
```

### [paddle.Tensor.digamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#digamma-name-none)

```python
paddle.Tensor.digamma(name=None)
```

两者功能完全一致,无参数。
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [ 无参数 ]torch.Tensor.dim

### [torch.Tensor.dim](https://pytorch.org/docs/stable/generated/torch.Tensor.dim.html?highlight=dim#torch.Tensor.dim)

```python
torch.Tensor.dim()
```

### [paddle.Tensor.dim](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#dim)

```python
paddle.Tensor.dim()
```

两者功能完全一致,无参数。
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## [ 仅参数名不一致 ]torch.Tensor.dist

### [torch.Tensor.dist](https://pytorch.org/docs/stable/generated/torch.Tensor.dist.html?highlight=dist#torch.Tensor.dist)

```python
torch.Tensor.dist(other, p=2)
```

### [paddle.Tensor.dist](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#dist-y-p-2)

```python
paddle.Tensor.dist(y, p=2)
```

两者功能一致且参数用法一致,仅参数名不同,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | --------------------------- |
| other | y | 输入 Tensor,仅参数名不同。 |
| p | p | 需要计算的范数。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## [ 仅参数名不一致 ]torch.Tensor.dot

### [torch.Tensor.dot](https://pytorch.org/docs/stable/generated/torch.Tensor.dot.html?highlight=dot#torch.Tensor.dot)

```python
torch.Tensor.dot(other)
```

### [paddle.Tensor.dot](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#dot-y-name-none)

```python
paddle.Tensor.dot(y, name=None)
```

两者功能一致且参数用法一致,仅参数名不同,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | --------------------------- |
| other | y | 输入 Tensor,仅参数名不同。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [ 无参数 ]torch.Tensor.element_size

### [torch.Tensor.element_size](https://pytorch.org/docs/stable/generated/torch.Tensor.element_size.html?highlight=element_size#torch.Tensor.element_size)

```python
torch.Tensor.element_size()
```

### [paddle.Tensor.element_size](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#element-size)

```python
paddle.Tensor.element_size()
```

两者功能完全一致,无参数。
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## [ 仅参数名不一致 ]torch.Tensor.eq

### [torch.Tensor.eq](https://pytorch.org/docs/stable/generated/torch.Tensor.eq.html?highlight=eq#torch.Tensor.eq)

```python
torch.Tensor.eq(other)
```

### [paddle.Tensor.equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#equal-y-name-none)

```python
paddle.Tensor.equal(y, name=None)
```

两者功能一致且参数用法一致,仅参数名不同,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | --------------------------- |
| other | y | 输入 Tensor,仅参数名不同。 |
Loading