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

映射文档 torch.nn.functional.embedding #5928

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

LokeZhou
Copy link
Contributor

@LokeZhou LokeZhou commented Jun 9, 2023

add document function.embedding

@paddle-bot
Copy link

paddle-bot bot commented Jun 9, 2023

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-5928.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@@ -0,0 +1,42 @@
## torch.nn.functional.binary_cross_entropy
Copy link
Collaborator

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.

done

| padding_idx | padding_idx | 在此区间内的参数及对应的梯度将会以 0 进行填充 |
| max_norm | - | 如果给定,Embeddding 向量的范数(范数的计算方式由 norm_type 决定)超过了 max_norm 这个界限,就要再进行归一化,PaddlePaddle 无此功能,暂无转写方式。 |
| norm_type | - | 为 maxnorm 选项计算 p-范数的 p。默认值 2,PaddlePaddle 暂无此功能,暂无转写方式。 |
| scale_grad_by_freq | - | 是否根据单词在 mini-batch 中出现的频率,对梯度进行放缩,PaddlePaddle 暂无此功能。 |
Copy link
Collaborator

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.

done

Copy link
Collaborator

Choose a reason for hiding this comment

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

写成统一一致的吧:暂无转写方式

| norm_type | - | 为 maxnorm 选项计算 p-范数的 p。默认值 2,PaddlePaddle 暂无此功能,暂无转写方式。 |
| scale_grad_by_freq | - | 是否根据单词在 mini-batch 中出现的频率,对梯度进行放缩,PaddlePaddle 暂无此功能。 |
| sparse | sparse | 表示是否使用稀疏更新。 |
| - | name | Pytorch 无此参数,Paddle 保持默认即可。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

所有API的name参数,都忽略即可

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@zhwesky2010
Copy link
Collaborator

CI要检查一下

@@ -0,0 +1,42 @@
## [ 参数不一致 ] torch.nn.functional.binary_cross_entropy
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个是torch参数更多吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

| padding_idx | padding_idx | 在此区间内的参数及对应的梯度将会以 0 进行填充 |
| max_norm | - | 如果给定,Embeddding 向量的范数(范数的计算方式由 norm_type 决定)超过了 max_norm 这个界限,就要再进行归一化,PaddlePaddle 无此功能,暂无转写方式。 |
| norm_type | - | 为 maxnorm 选项计算 p-范数的 p。默认值 2,PaddlePaddle 暂无此功能,暂无转写方式。 |
| scale_grad_by_freq | - | 是否根据单词在 mini-batch 中出现的频率,对梯度进行放缩,PaddlePaddle 暂无此功能。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

写成统一一致的吧:暂无转写方式

@@ -33,3 +33,21 @@ paddle.nn.Embedding(num_embeddings,
| scale_grad_by_freq | - | 是否根据单词在 mini-batch 中出现的频率,对梯度进行放缩,PaddlePaddle 暂无此功能。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

这些都用统一的话术描述:Paddle无此功能,暂无转写方式。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 输入 Tensor |
| kernel_size | kernel_sizes | 卷积核大小, PyTorch 参数类型为 int、tuple(int) 或者 list(int), Paddle 参数类型为 int 或者 list(int)。 |
| dilation | dilations | 卷积膨胀,PyTorch 参数类型为 int、tuple(int) 或者 list(int), Paddle 参数类型为 int 或者 list(int)。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以写成,Pytorch支持int、tuple(int) 或者 list(int),Paddle仅支持int 或者 list(int),突出我们比他们少

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@zhwesky2010 zhwesky2010 changed the title add document function.embedding 映射关系 add document function.embedding Jun 20, 2023
@zhwesky2010 zhwesky2010 changed the title 映射关系 add document function.embedding 映射文档 add document function.embedding Jun 20, 2023
@zhwesky2010 zhwesky2010 changed the title 映射文档 add document function.embedding 映射文档 torch.nn.function.embedding Jun 20, 2023
@zhwesky2010 zhwesky2010 changed the title 映射文档 torch.nn.function.embedding 映射文档 torch.nn.functional.embedding Jun 20, 2023
Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

需要写是在转写哪个参数,参考模板来

| sparse | sparse | 表示是否使用稀疏更新。 |

### 转写示例
```python
Copy link
Collaborator

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.

done

Copy link
Collaborator

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.

无参数转写,已删除

| padding | paddings | 每个维度的扩展,仅参数名不一致。 |
| stride | strides | 卷积步长,仅参数名不一致。 |
### 转写示例
``` python
Copy link
Collaborator

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.

done



### 转写示例
```python
Copy link
Collaborator

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.

done

| sparse | sparse | 表示是否使用稀疏更新。 |

### 转写示例
```python
Copy link
Collaborator

Choose a reason for hiding this comment

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

那这个是转哪个参数呢


### [torch.nn.functional.unfold](https://pytorch.org/docs/1.13/generated/torch.nn.functional.unfold.html#torch.nn.functional.unfold)
## [ 参数名不一致 ]torch.nn.functional.unfold
Copy link
Collaborator

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.

done

@@ -28,8 +28,27 @@ paddle.nn.Embedding(num_embeddings,
| num_embeddings | num_embeddings | 表示嵌入字典的大小。 |
| embedding_dim | embedding_dim | 表示每个嵌入向量的维度。 |
| padding_idx | padding_idx | 在此区间内的参数及对应的梯度将会以 0 进行填充 |
Copy link
Collaborator

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.

done

# paddle 写法
paddle.nn.Embedding(4, 3,padding_idx=0)

# 当 PyTorch 使用 max_norm、norm_type、scale_grad_by_freq 任意参数时,暂不支持转写
Copy link
Collaborator

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.

done

torch.nn.Embedding(4, 3)

# paddle 写法
paddle.nn.Embedding(4,3)
Copy link
Collaborator

@zhwesky2010 zhwesky2010 Jul 4, 2023

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.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants