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 SequentialSampler doc ,fix torch.nn.Upsample.md #5949

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## [ 仅 paddle 参数更多 ]torch.nn.Upsample
### [torch.nn.Upsample](https://pytorch.org/docs/stable/generated/torch.nn.Upsample.html?highlight=upsample#torch.nn.Upsample)
## [ torch 参数更多 ]torch.nn.Upsample
### [torch.nn.Upsample](https://pytorch.org/docs/stable/generated/torch.nn.Upsample.html?highlight=torch+nn+upsample#torch.nn.Upsample)

```python
torch.nn.Upsample(size=None,
Expand Down Expand Up @@ -28,5 +28,24 @@ paddle.nn.Upsample(size=None,
| scale_factor | scale_factor | 输入的高度或宽度的乘数因子。 |
| mode | mode | 表示插值方法。 |
| align_corners | align_corners | 表示是否将输入和输出张量的 4 个角落像素的中心对齐,并保留角点像素的值。 |
| recompute_scale_factor | - | 重新计算 scale_actor 以用于插值计算,Paddle 暂无转写方式。 |
| - | align_mode | 双线性插值的可选项,PyTorch 无此参数,Paddle 保持默认即可。 |
| - | data_format | Tensor 的所需数据类型,PyTorch 无此参数,Paddle 保持默认即可。 |


### 转写示例
```python
# Pytorch 写法
torch.nn.Upsample(scale_factor=2, mode='nearest')

# Paddle 写法
paddle.nn.Upsample(scale_factor=2, mode='nearest')
```

```python
# Pytorch 写法
torch.nn.Upsample(size=(2,2))

# Paddle 写法
paddle.nn.Upsample(size=(2,2))
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## [参数完全一致]torch.utils.data.Sampler

### [torch.utils.data.SequentialSampler](https://pytorch.org/docs/stable/data.html?highlight=torch+utils+data+sequentialsampler#torch.utils.data.SequentialSampler)

```python
torch.utils.data.SequentialSampler(data_source)
```

### [paddle.io.SequenceSampler](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/io/SequenceSampler_cn.html#sequencesampler)

```python
paddle.io.SequenceSampler(data_source)
```

paddle 参数和 torch 参数完全一致,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ----------- | ------------ | -------------------------------------- |
| data_source | data_source | Dataset 或者 IterableDataset 的子类实现。 |


### 转写示例
```python
# Pytorch 写法
torch.utils.data.SequentialSampler(dataset)

# Paddle 写法
paddle.io.SequenceSampler(dataset)
```