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

【Hackathon 7th No.41】NO.41 为 Paddle 代码转换工具新增 API 转换规则(第 8 组) #6887

Merged
merged 21 commits into from
Oct 22, 2024
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## [torch 参数更多 ]torch.distributions.chi2.Chi2

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

```python
torch.distributions.chi2.Chi2(df, validate_args=None)
```

### [paddle.distribution.Chi2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Chi2_cn.html#prob-value)

```python
paddle.distribution.Chi2(df)
```

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

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| -------------- | ------------ | ----------------------------------------------------------------------- |
| df | df | 表示输入的参数。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## [功能缺失 ]torch.distributions.constraints.Constraint
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个不是功能缺失,仔细查阅paddle源码,以源代码为准


### [torch.distributions.constraints.Constraint](https://pytorch.org/docs/stable/distributions.html#module-torch.distributions.constraints)

```python
torch.distributions.constraints.Constraint(is_discrete, event_dim)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [torch 参数更多 ]torch.distributions.gamma.Gamma

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

```python
torch.distributions.gamma.Gamma(concentration, rate, validate_args=None)
```

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

```python
paddle.distribution.Gamma(concentration, rate)
```

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

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ----------------------------------------------------------------------- |
| concentration | concentration | 表示输入的参数。 |
| rate | rate | 表示输入的参数。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## [torch 参数更多 ]torch.distributions.lkj_cholesky.LKJCholesky

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

```python
torch.distributions.lkj_cholesky.LKJCholesky(dim, concentration=1.0, validate_args=None)
```

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

```python
paddle.distribution.LKJCholesky(dim, concentration=1.0, sample_method='onion')
```

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

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------- | ----------------------------------------------------------------------- |
| dim | dim | 表示输入的参数。 |
| concentration | concentration | 表示输入的参数。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
| - | sample_method | pytorch无此参数,保持默认即可。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

paddle保持默认即可

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## [torch 参数更多 ]torch.distributions.poisson.Poisson

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

```python
torch.distributions.poisson.Poisson(rate, validate_args=None)
```

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

```python
paddle.distribution.Poisson(rate)
```

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

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------- | ----------------------------------------------------------------------- |
| rate | rate | 表示输入的参数。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## [torch 参数更多 ]torch.distributions.studentT.StudentT

### [torch.distributions.studentT.StudentT](https://pytorch.org/docs/stable/distributions.html#studentt)

```python
torch.distributions.studentT.StudentT(df, loc=0.0, scale=1.0, validate_args=None)
```

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

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

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

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------- | ----------------------------------------------------------------------- |
| df | df | 表示输入的参数。 |
| loc | loc | 表示输入的参数。 |
| scale | scale | 表示输入的参数。 |
| validate_args | - | 是否添加验证环节。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## [ 功能缺失 ]torch.distributions.transforms.PositiveDefiniteTransform
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个找办法组合实现

infoflow 2024-09-24 17-17-53

判定为功能缺失需要慎重,只有确实需要在Paddle中新增API的才可判定功能缺失,尽可能要通过组合实现、或者paconvert的辅助函数aux_code实现

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的好的,目前正在修改

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经全都弄好了,请review


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

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