Skip to content

Commit 189cd71

Browse files
authored
Fix docs (#6870)
* fix hsplit * fix docs * fix * fix-docs1 * fix docs * fix docs * docs1 * fix docs * fix docs * fix docs1 * fix docs * fix-docs * fix docs * fix-docs * fix-docs * fix-docs1 * fix-docs1 * fix-docs1 * fix -docs1 * fix paddle default
1 parent 3951a58 commit 189cd71

11 files changed

+306
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [无参数]torch.cuda.is_bf16_supported
2+
3+
### [torch.cuda.is_bf16_supported](https://pytorch.org/docs/stable/cuda.html)
4+
5+
```python
6+
torch.cuda.is_bf16_supported()
7+
```
8+
9+
### [paddle.amp.is_bfloat16_supported](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/is_bfloat16_supported_cn.html#is-bfloat16-supported)
10+
11+
```python
12+
paddle.amp.is_bfloat16_supported()
13+
```
14+
15+
功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## [ torch 参数更多 ] torch.distributions.Binomial
2+
3+
### [torch.distributions.Binomial](https://pytorch.org/docs/stable/distributions.html#torch.distributions.binomial.Binomial)
4+
5+
```python
6+
torch.distributions.Binomial(total_count=1,
7+
probs=None,
8+
logits=None,
9+
validate_args=None)
10+
```
11+
12+
### [paddle.distribution.Binomial](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/Binomial_cn.html#binomial)
13+
14+
```python
15+
paddle.distribution.Binomial(total_count,
16+
probs)
17+
```
18+
19+
PyTorch 相比 Paddle 支持更多其他参数,具体如下:
20+
21+
### 参数映射
22+
23+
| PyTorch | PaddlePaddle | 备注 |
24+
| ------------- | ------ | ------------------------------------------------------------ |
25+
| total_count | total_count | 样本大小。 |
26+
| probs | probs | 每次伯努利实验中事件发生的概率。 |
27+
| logits | - | 采样 1 的 log-odds,Paddle 无此参数,暂无转写方式。 |
28+
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## [ torch 参数更多 ] torch.distributions.ContinuousBernoulli
2+
3+
### [torch.distributions.ContinuousBernoulli](https://pytorch.org/docs/stable/distributions.html)
4+
5+
```python
6+
torch.distributions.ContinuousBernoulli(probs=None,
7+
logits=None,
8+
lims=(0.499, 0.501)
9+
validate_args=None)
10+
```
11+
12+
### [paddle.distribution.ContinuousBernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/ContinuousBernoulli_cn.html#continuousbernoulli)
13+
14+
```python
15+
paddle.distribution.ContinuousBernoulli(probs,
16+
lims=(0.499, 0.501))
17+
```
18+
19+
PyTorch 相比 Paddle 支持更多其他参数,具体如下:
20+
21+
### 参数映射
22+
23+
| PyTorch | PaddlePaddle | 备注 |
24+
| ------------- | ------ | ------------------------------------------------------------ |
25+
| probs | probs | 参数化分布的 (0,1) 值。 |
26+
| logits | - | 实值参数,与 probs 通过 sigmoid 函数匹配。Paddle 无此参数,暂无转写方式。 |
27+
| lims | lims | 一个包含两个元素的元组,指定了分布的下限和上限,默认为 (0.499, 0.501)。 |
28+
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## [ torch 参数更多 ] torch.distributions.Exponential
2+
3+
### [torch.distributions.Exponential](https://pytorch.org/docs/stable/distributions.html#torch.distributions.exponential.Exponential.arg_constraints)
4+
5+
```python
6+
torch.distributions.Exponential(rate,
7+
validate_args=None)
8+
```
9+
10+
### [paddle.distribution.Exponential](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/ExponentialFamily_cn.html#exponential)
11+
12+
```python
13+
paddle.distribution.Exponential(rate)
14+
```
15+
16+
PyTorch 相比 Paddle 支持更多其他参数,具体如下:
17+
18+
### 参数映射
19+
20+
| PyTorch | PaddlePaddle | 备注 |
21+
| ------------- | ------ | ------------------------------------------------------------ |
22+
| rate | rate | 分布的速率参数。 |
23+
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## [ torch 参数更多 ] torch.distributions.MultivariateNormal
2+
3+
### [torch.distributions.MultivariateNormal](https://pytorch.org/docs/stable/distributions.html#multivariatenormal)
4+
5+
```python
6+
torch.distributions.MultivariateNormal(loc,
7+
covariance_matrix=None,
8+
precision_matrix=None,
9+
scale_tril=None,
10+
validate_args=None)
11+
```
12+
13+
### [paddle.distribution.MultivariateNormal](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/MultivariateNormal_cn.html#multivariatenormal)
14+
15+
```python
16+
paddle.distribution.MultivariateNormal(loc,
17+
covariance_matrix=None,
18+
precision_matrix=None,
19+
scale_tril=None)
20+
```
21+
22+
PyTorch 相比 Paddle 支持更多其他参数,具体如下:
23+
24+
### 参数映射
25+
26+
| PyTorch | PaddlePaddle | 备注 |
27+
| ------------- | ------ | ------------------------------------------------------------ |
28+
| loc | loc | MultivariateNormal 的均值向量。 |
29+
| covariance_matrix | covariance_matrix | MultivariateNormal 的协方差矩阵。 |
30+
| precision_matrix | precision_matrix | MultivariateNormal 协方差矩阵的逆矩阵。 |
31+
| scale_tril | scale_tril | MultivariateNormal 协方差矩阵的柯列斯基分解的下三角矩阵。 |
32+
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## [ paddle 参数更多 ]torch.nn.functional.channel_shuffle
2+
3+
### [torch.nn.functional.channel_shuffle](https://pytorch.org/docs/stable/generated/torch.nn.ChannelShuffle.html)
4+
5+
```python
6+
torch.nn.functional.channel_shuffle(input,
7+
groups)
8+
```
9+
10+
### [paddle.nn.functional.channel_shuffle](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/channel_shuffle_cn.html#channel-shuffle)
11+
12+
```python
13+
paddle.nn.functional.channel_shuffle(x,
14+
groups,
15+
data_format='NCHW',
16+
name=None)
17+
```
18+
19+
其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:
20+
### 参数映射
21+
22+
| PyTorch | PaddlePaddle | 备注 |
23+
| ------------- | ------------ | ------------------------------------------------------ |
24+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
25+
| groups | groups | 表示要把通道分成的组数。 |
26+
| - | data_format | 数据格式,可选:NCHW 或 NHWC。PyTorch 无此参数,Paddle 保持默认即可。 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## [torch 参数更多] torch.special.gammainc
2+
3+
### [torch.special.gammainc](https://pytorch.org/docs/stable/special.html#torch.special.gammainc)
4+
5+
```python
6+
torch.special.gammainc(input,
7+
other,
8+
*,
9+
out=None)
10+
```
11+
12+
### [paddle.gammainc](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/index_cn.html)
13+
14+
```python
15+
paddle.gammainc(x,
16+
y)
17+
```
18+
19+
PyTorch 相比 Paddle 支持更多其他参数,具体如下:
20+
21+
### 参数映射
22+
23+
| PyTorch | PaddlePaddle | 备注 |
24+
| ------------- | ------ | ------------------------------------------------------------ |
25+
| input | x | 第一个非负输入张量,仅参数名不一致。 |
26+
| other | y | 第二个非负输入张量,仅参数名不一致。 |
27+
| out | - | Paddle 无此参数,需要转写。 |
28+
29+
### 转写示例
30+
31+
#### out:指定输出
32+
33+
```python
34+
# PyTorch 写法
35+
torch.special.gammainc(torch.tensor([1.0,2.0]),torch.tensor([3.0,4.0]),out=y)
36+
37+
# Paddle 写法
38+
paddle.assign(paddle.gammainc(paddle.to_tensor([1.0,2.0]),paddle.to_tensor([3.0,4.0])), y)
39+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## [ torch 参数更多 ]torch.special.gammaincc
2+
3+
### [torch.special.gammaincc](https://pytorch.org/docs/stable/special.html#torch.special.gammaincc)
4+
5+
```python
6+
torch.special.gammaincc(input,
7+
other,
8+
*,
9+
out=None)
10+
```
11+
12+
### [paddle.gammaincc](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/index_cn.html)
13+
14+
```python
15+
paddle.gammaincc(x,
16+
y)
17+
```
18+
19+
PyTorch 相比 Paddle 支持更多其他参数,具体如下:
20+
21+
### 参数映射
22+
23+
| PyTorch | PaddlePaddle | 备注 |
24+
| ------------- | ------ | ------------------------------------------------------------ |
25+
| input | x | 第一个非负输入张量,仅参数名不一致。 |
26+
| other | y | 第二个非负输入张量,仅参数名不一致。 |
27+
| out | - | Paddle 无此参数,需要转写。 |
28+
29+
### 转写示例
30+
#### out:指定输出
31+
```python
32+
# PyTorch 写法
33+
torch.special.gammaincc(torch.tensor([1.0,2.0]),torch.tensor([3.0,4.0]),out=y)
34+
35+
# Paddle 写法
36+
paddle.assign(paddle.gammaincc(paddle.to_tensor([1.0,2.0]),paddle.to_tensor([3.0,4.0])), y)
37+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## [ 参数完全一致 ] torch._\_version__.split
2+
3+
### [torch._\_version__.split]()
4+
5+
```python
6+
torch.__version__.split(sep=None, maxsplit=-1)
7+
```
8+
9+
### [paddle._\_version__.split]()
10+
11+
```python
12+
paddle.__version__.split(sep=None, maxsplit=-1)
13+
```
14+
15+
两者功能一致,参数完全一致,具体如下:
16+
### 参数映射
17+
18+
| PyTorch | PaddlePaddle | 备注 |
19+
|---------|--------------| -------------------------------------------------- |
20+
| sep | sep | 分割字符串的分隔符。 |
21+
| max | max | 分割操作的最大次数 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## [ torch 参数更多 ] torch.amp.autocast
2+
3+
### [torch.amp.autocast](https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.autocast)
4+
5+
```python
6+
torch.amp.autocast(device_type,
7+
dtype=None,
8+
enabled=True,
9+
cache_enabled=None)
10+
```
11+
12+
### [paddle.amp.auto_cast](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/auto_cast_cn.html#auto-cast)
13+
14+
```python
15+
paddle.amp.auto_cast(enable=True,
16+
custom_white_list=None,
17+
custom_black_list=None,
18+
level='O1',
19+
dtype='float16',
20+
use_promote=True)
21+
```
22+
23+
PyTorch 相比 Paddle 支持更多其他参数,具体如下:
24+
25+
### 参数映射
26+
27+
| PyTorch | PaddlePaddle | 备注 |
28+
| ------------- | ------ | ------------------------------------------------------------ |
29+
| device_type | - | 指定设备类型,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
30+
| dtype | dtype | 指定自动混合精度的计算类型 |
31+
| enabled | enable | 是否启用自动混合精度。 |
32+
| cache_enabled | - | 启用或禁用 CUDA 图形缓存 Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
33+
| - | custom_white_list | 白名单,通常不需要设置。PyTorch 无此参数,Paddle 保持默认即可。 |
34+
| - | custom_black_list | 黑名单,通常不需要设置。PyTorch 无此参数,Paddle 保持默认即可。 |
35+
| - | level | 混合精度训练的优化级别,可为 O1 、O2 或者 OD 模式。PyTorch 无此参数,Paddle 保持默认即可。 |
36+
| - | use_promote | 当一个算子存在 float32 类型的输入时,按照 Promote to the Widest 原则,选择 float32 数据类型进行计算。PyTorch 无此参数,Paddle 保持默认即可。 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## [ 参数完全一致 ] flash_attn._\_version__.split
2+
3+
### [flash_attn._\_version__.split](https://github.com/Dao-AILab/flash-attention/blob/72e27c6320555a37a83338178caa25a388e46121/flash_attn/__init__.py)
4+
5+
```python
6+
flash_attn.__version__.split(sep=None, maxsplit=-1)
7+
```
8+
9+
### [paddle._\_version__.split](https://github.com/PaddlePaddle/Paddle/tree/develop)
10+
11+
```python
12+
paddle.__version__.split(sep=None, maxsplit=-1)
13+
```
14+
15+
两者功能一致,参数完全一致,具体如下:
16+
### 参数映射
17+
18+
| flash_attn | PaddlePaddle | 备注 |
19+
|---------|--------------| -------------------------------------------------- |
20+
| sep | sep | 分割字符串的分隔符。 |
21+
| max | max | 分割操作的最大次数 |

0 commit comments

Comments
 (0)