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. 165-184 #6044

Merged
merged 2 commits into from
Jul 24, 2023
Merged
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
@@ -0,0 +1,23 @@
## [torch 参数更多]torch.distributions.bernoulli.Bernoulli

### [torch.distributions.bernoulli.Bernoulli](https://pytorch.org/docs/stable/distributions.html#torch.distributions.bernoulli.Bernoulli)

```python
torch.distributions.bernoulli.Bernoulli(probs=None, logits=None, validate_args=None)
```

### [paddle.distribution.Bernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/Bernoulli_cn.html#bernoulli)

```python
paddle.distribution.Bernoulli(probs, name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ----------------------------------------------------------------------- |
| probs | probs | 伯努利分布的概率输入。 |
| logits | - | 采样 1 的 log-odds,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ paddle.distribution.Categorical(logits, name=None)
| ------------- | ------------ | --------------------------------------------- |
| probs | - | 事件概率,Paddle 无此参数,暂无转写方式。 |
| logits | logits | 类别分布对应的 logits。 |
| validate_args | - | 有效参数列表,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [torch 参数更多]torch.distributions.cauchy.Cauchy

### [torch.distributions.cauchy.Cauchy](https://pytorch.org/docs/stable/distributions.html#torch.distributions.cauchy.Cauchy)

```python
torch.distributions.cauchy.Cauchy(loc, scale, validate_args=None)
```

### [paddle.distribution.Cauchy](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Cauchy_cn.html)

```python
paddle.distribution.Cauchy(loc, scale, name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ----------------------------------------------------------------------- |
| loc | loc | 定义分布峰值位置的位置参数。 |
| scale | scale | 最大值一半处的一半宽度的尺度参数。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ paddle.distribution.Dirichlet(concentration)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------- | --------------------------------------------- |
| concentration | concentration | 浓度参数,即公式中 α 参数。 |
| validate_args | - | 有效参数列表,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ paddle.distribution.Distribution(batch_shape, event_shape)
| ------------- | ------------ | --------------------------------------------- |
| batch_shape | batch_shape | 概率分布参数批量形状。 |
| event_shape | event_shape | 多元概率分布维数形状。 |
| validate_args | - | 有效参数列表,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ paddle.distribution.ExponentialFamily(batch_shape, event_shape)
| ------------- | ------------- | --------------------------------------------- |
| batch_shape | batch_shape, | 概率分布参数批量形状。 |
| event_shape | event_shape | 多元概率分布维数形状。 |
| validate_args | - | 有效参数列表,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [torch 参数更多]torch.distributions.geometric.Geometric

### [torch.distributions.geometric.Geometric](https://pytorch.org/docs/stable/distributions.html#torch.distributions.geometric.Geometric)

```python
torch.distributions.geometric.Geometric(probs=None, logits=None, validate_args=None)
```

### [paddle.distribution.Geometric](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/Geometric_cn.html#geometric)

```python
paddle.distribution.Geometric(probs)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ----------------------------------------------------------------------- |
| probs | probs | 几何分布成功概率参数。 |
| logits | - | 采样 1 的 log-odds,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [torch 参数更多]torch.distributions.gumbel.Gumbel

### [torch.distributions.gumbel.Gumbel](https://pytorch.org/docs/stable/distributions.html#torch.distributions.gumbel.Gumbel)

```python
torch.distributions.gumbel.Gumbel(loc, scale, validate_args=None)
```

### [paddle.distribution.Gumbel](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/Gumbel_cn.html#gumbel)

```python
paddle.distribution.Gumbel(loc, scale)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ----------------------------------------------------------------------- |
| loc | loc | 耿贝尔分布位置参数。 |
| scale | scale | 耿贝尔分布尺度参数。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ paddle.distribution.Independent(base, reinterpreted_batch_rank)
| ------------------------- | ------------------------ | ------------------------------------------------ |
| base_distribution | base | 基础分布,仅参数名不一致。 |
| reinterpreted_batch_ndims | reinterpreted_batch_rank | 用于转换为事件维度的批维度数量,仅参数名不一致。 |
| validate_args | - | 有效参数列表,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [torch 参数更多]torch.distributions.laplace.Laplace

### [torch.distributions.laplace.Laplace](https://pytorch.org/docs/stable/distributions.html#torch.distributions.laplace.Laplace)

```python
torch.distributions.laplace.Laplace(loc, scale, validate_args=None)
```

### [paddle.distribution.Laplace](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Laplace_cn.html#laplace)

```python
paddle.distribution.Laplace(loc, scale)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ----------------------------------------------------------------------- |
| loc | loc | 拉普拉斯分布位置参数。 |
| scale | scale | 拉普拉斯分布尺度参数。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [torch 参数更多]torch.distributions.log_normal.LogNormal

### [torch.distributions.log_normal.LogNormal](https://pytorch.org/docs/stable/distributions.html#torch.distributions.log_normal.LogNormal)

```python
torch.distributions.log_normal.LogNormal(loc, scale, validate_args=None)
```

### [paddle.distribution.Normal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Normal_cn.html#normal)

```python
paddle.distribution.Normal(loc, scale, name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ----------------------------------------------------------------------- |
| loc | loc | 正态分布平均值。 |
| scale | scale | 正态分布标准差。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ paddle.distribution.Multinomial(total_count, probs)
| total_count | total_count | 实验次数。 |
| probs | probs | 每个类别发生的概率。 |
| logits | - | 事件 log 概率,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 有效参数列表,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ paddle.distribution.Normal(loc, scale, name=None)
| ------------- | ------------ | --------------------------------------------- |
| loc | loc | 正态分布平均值。 |
| scale | scale | 正态分布标准差。 |
| validate_args | - | 有效参数列表,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [torch 参数更多]torch.distributions.transformed_distribution.TransformedDistribution

### [torch.distributions.transformed_distribution.TransformedDistribution](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transformed_distribution.TransformedDistribution)

```python
torch.distributions.transformed_distribution.TransformedDistribution(base_distribution, transforms, validate_args=None)
```

### [paddle.distribution.TransformedDistribution](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/TransformedDistribution_cn.html#transformeddistribution)

```python
paddle.distribution.TransformedDistribution(base, transforms)
```

其中 PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ----------------- | ------------ | ----------------------------------------------------------------------- |
| base_distribution | base | 基础分布,仅参数名不一致。 |
| transforms | transforms | 变换序列。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## [torch 参数更多]torch.distributions.transforms.Transform

### [torch.distributions.transforms.Transform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.Transform)

```python
torch.distributions.transforms.Transform(cache_size=0)
```

### [paddle.distribution.Transform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Transform_cn.html#transform)

```python
paddle.distribution.Transform()
```

其中 PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ---------- | ------------ | -------------------------------------------------------------------------- |
| cache_size | - | 表示 cache 大小,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ paddle.distribution.Uniform(low, high, name=None)
| ------------- | ------------ | --------------------------------------------- |
| low | low | 均匀分布的下边界。 |
| high | high | 均匀分布的上边界。 |
| validate_args | - | 有效参数列表,Paddle 无此参数,暂无转写方式。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,10 @@
| ---- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| 1 | [torch.distributions.kl.kl_divergence](https://pytorch.org/docs/stable/distributions.html?highlight=torch+distributions+kl+kl_divergence#torch.distributions.kl.kl_divergence) | [paddle.distribution.kl_divergence](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/kl_divergence_cn.html) | 功能一致,参数一致, [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.kl.kl_divergence.md) |
| 2 | [torch.distributions.kl.register_kl](https://pytorch.org/docs/stable/distributions.html?highlight=register_kl#torch.distributions.kl.register_kl) | [paddle.distribution.register_kl](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/register_kl_cn.html) | 功能一致,仅参数名不一致, [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.kl.register_kl.md) |
| 3 | [torch.distributions.binomial.Binomial](https://pytorch.org/docs/stable/distributions.html#torch.distributions.binomial.Binomial) | | 功能缺失 |
| 4 | [torch.distributions.continuous_bernoulli.ContinuousBernoulli](https://pytorch.org/docs/stable/distributions.html#torch.distributions.continuous_bernoulli.ContinuousBernoulli) | | 功能缺失 |
| 5 | [torch.distributions.exponential.Exponential](https://pytorch.org/docs/stable/distributions.html#torch.distributions.exponential.Exponential) | | 功能缺失 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要以最新的paddle为准,这两个都已经有:
infoflow 2023-07-24 12-11-04

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改添加Gumbel, Geometric

| 6 | [torch.distributions.one_hot_categorical.OneHotCategorical](https://pytorch.org/docs/stable/distributions.html#torch.distributions.one_hot_categorical.OneHotCategorical) | | 功能缺失 |


***持续更新...***
Expand Down