Skip to content

Commit a536830

Browse files
authored
Merge branch 'PaddlePaddle:develop' into TensorFlow-Paddle-docs
2 parents cd5c193 + 1b91071 commit a536830

File tree

124 files changed

+2354
-303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+2354
-303
lines changed

ci_scripts/gendoc.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,31 @@ export DOCROOT
1515

1616
# install paddle if not installed yet.
1717
# PADDLE_WHL is defined in ci_start.sh
18-
pip3 list --disable-pip-version-check | grep paddlepaddle > /dev/null
19-
if [ $? -ne 0 ] ; then
20-
pip3 install --no-cache-dir -q --progress-bar off -i https://pypi.tuna.tsinghua.edu.cn/simple ${PADDLE_WHL}
18+
if ! pip3 list --disable-pip-version-check | grep paddlepaddle; then
19+
echo "Paddle is not found, attempting to install from ${PADDLE_WHL}..."
20+
21+
# Install logic:
22+
# - If PADDLE_WHL is a .whl file URL: download and install locally
23+
# - Otherwise: install directly via pip (supports package names and other URLs)
24+
if [[ "${PADDLE_WHL}" == *.whl ]]; then
25+
echo "Downloading wheel file: ${PADDLE_WHL}"
26+
wget -q ${PADDLE_WHL} -O /tmp/paddle.whl
27+
if [ $? -ne 0 ]; then
28+
echo -e "\e[31mError: Failed to download wheel file from ${PADDLE_WHL}\e[0m"
29+
exit 1
30+
fi
31+
echo "Installing local wheel file..."
32+
pip3 install --no-cache-dir -q --progress-bar off -i https://pypi.tuna.tsinghua.edu.cn/simple /tmp/paddle.whl
33+
else
34+
echo "Using pip install directly..."
35+
pip3 install --no-cache-dir -q --progress-bar off -i https://pypi.tuna.tsinghua.edu.cn/simple ${PADDLE_WHL}
36+
fi
37+
38+
if [ $? -ne 0 ]; then
39+
echo -e "\e[31mError: Failed to install paddle from ${PADDLE_WHL}\e[0m"
40+
exit 1
41+
fi
42+
echo "Paddle installed successfully."
2143
fi
2244

2345

docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.nn.functional.glu.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
## [ 仅参数名不一致 ]torch.nn.functional.glu
22
### [torch.nn.functional.glu](https://pytorch.org/docs/stable/generated/torch.nn.functional.glu.html?highlight=glu#torch.nn.functional.glu)
33
```python
4-
torch.nn.functional.glu(input, dim=- 1)
4+
torch.nn.functional.glu(input, dim=-1)
55
```
66

77
### [paddle.nn.functional.glu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/glu_cn.html)
88
```python
9-
paddle.nn.functional.glu(x, axis=- 1, name=None)
9+
paddle.nn.functional.glu(x, axis=-1, name=None)
1010
```
1111

1212
两者功能一致,仅参数名不一致,具体如下:

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.Tensor.bernoulli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ torch.Tensor.bernoulli(generator=None)
99
### [paddle.bernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/bernoulli_cn.html#paddle/bernoulli_cn#cn-api-paddle-bernoulli)
1010

1111
```python
12-
paddle.bernoulli(x, name=None)
12+
paddle.bernoulli(x, p=None, name=None)
1313
```
1414

1515
两者功能一致,但调用方式不一致,具体如下:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## [ 仅 API 调用方式不一致 ]torch.Tensor.sparse_mask
2+
3+
### [torch.Tensor.sparse_mask](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.sparse_mask)
4+
5+
```python
6+
torch.Tensor.sparse_mask(mask)
7+
```
8+
9+
### [paddle.sparse.mask_as](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sparse/mask_as_cn.html#paddle/sparse/mask_as_cn#cn-api-paddle-sparse-mask_as)
10+
11+
```python
12+
paddle.sparse.mask_as(x, mask, name=None)
13+
```
14+
15+
两者功能一致,但调用方式不一致,具体如下:
16+
17+
### 转写示例
18+
19+
```python
20+
# PyTorch 写法
21+
out = x.sparse_mask(coo)
22+
23+
# Paddle 写法
24+
out = paddle.sparse.mask_as(x, coo)
25+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## [ 仅 API 调用方式不一致 ]torch.distributions.distribution.Distribution.log_prob
2+
3+
### [torch.distributions.distribution.Distribution.log_prob](https://pytorch.org/docs/stable/generated/torch.distributions.distribution.Distribution.html#torch.distributions.distribution.Distribution.log_prob)
4+
5+
```python
6+
torch.distributions.distribution.Distribution.log_prob(value)
7+
```
8+
9+
### [paddle.distribution.Distribution.log_prob](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Distribution/log_prob_cn.html#paddle/distribution/Distribution/log_prob_cn#cn-api-paddle-distribution-Distribution-log_prob)
10+
11+
```python
12+
paddle.distribution.Distribution.log_prob(value)
13+
```
14+
15+
两者功能一致,但调用方式不一致,具体如下:
16+
17+
### 转写示例
18+
19+
```python
20+
# PyTorch 写法
21+
uniform = torch.distributions.Uniform(0.0, 1.0)
22+
result = uniform.log_prob(torch.tensor(0.3))
23+
24+
# Paddle 写法
25+
uniform = paddle.distribution.Uniform(0.0, 1.0)
26+
result = uniform.log_prob(paddle.to_tensor(0.3))
27+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## [ 仅 API 调用方式不一致 ]torch.max
2+
3+
### [torch.max](https://pytorch.org/docs/stable/generated/torch.max.html)
4+
5+
```python
6+
torch.max(*args, **kwargs)
7+
```
8+
9+
### [paddle.compat.max](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/max_cn.html#paddle/compat/max_cn#cn-api-paddle-compat-max)
10+
11+
```python
12+
paddle.compat.max(*args, **kwargs)
13+
```
14+
15+
torch.max 有多种签名与用法,均只需修改 torch 前缀为 paddle.compat,具体如下:
16+
17+
### 转写示例
18+
19+
```python
20+
# PyTorch 写法
21+
result = torch.max(x)
22+
23+
# Paddle 写法
24+
result = paddle.compat.max(x)
25+
26+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## [ 仅 API 调用方式不一致 ]torch.median
2+
3+
### [torch.median](https://pytorch.org/docs/stable/generated/torch.median.html)
4+
5+
```python
6+
torch.median(*args, **kwargs)
7+
```
8+
9+
### [paddle.compat.median](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/median_cn.html#paddle/compat/median_cn#cn-api-paddle-compat-median)
10+
11+
```python
12+
paddle.compat.median(*args, **kwargs)
13+
```
14+
15+
torch.median 有多种签名与用法,均只需修改 torch 前缀为 paddle.compat,具体如下:
16+
17+
### 转写示例
18+
19+
```python
20+
# PyTorch 写法
21+
result = torch.median(input)
22+
23+
# Paddle 写法
24+
result = paddle.compat.median(input)
25+
26+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## [ 仅 API 调用方式不一致 ]torch.min
2+
3+
### [torch.min](https://pytorch.org/docs/stable/generated/torch.min.html)
4+
5+
```python
6+
torch.min(*args, **kwargs)
7+
```
8+
9+
### [paddle.compat.min](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/min_cn.html#paddle/compat/min_cn#cn-api-paddle-compat-min)
10+
11+
```python
12+
paddle.compat.min(*args, **kwargs)
13+
```
14+
15+
torch.min 有多种签名与用法,均只需修改 torch 前缀为 paddle.compat,具体如下:
16+
17+
### 转写示例
18+
19+
```python
20+
# PyTorch 写法
21+
result = torch.min(x)
22+
23+
# Paddle 写法
24+
result = paddle.compat.min(x)
25+
26+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## [ 仅 API 调用方式不一致 ]torch.nanmedian
2+
3+
### [torch.nanmedian](https://pytorch.org/docs/stable/generated/torch.nanmedian.html)
4+
5+
```python
6+
torch.nanmedian(*args, **kwargs)
7+
```
8+
9+
### [paddle.compat.nanmedian](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/nanmedian_cn.html#paddle/compat/nanmedian_cn#cn-api-paddle-compat-nanmedian)
10+
11+
```python
12+
paddle.compat.nanmedian(*args, **kwargs)
13+
```
14+
15+
torch.namedian 有多种签名与用法,均只需修改 torch 前缀为 paddle.compat,具体如下:
16+
17+
### 转写示例
18+
19+
```python
20+
# PyTorch 写法
21+
result = torch.nanmedian(input)
22+
23+
# Paddle 写法
24+
result = paddle.compat.nanmedian(input)
25+
26+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## [ 仅 API 调用方式不一致 ]torch.nn.Unfold
2+
3+
### [torch.nn.Unfold](https://pytorch.org/docs/stable/generated/torch.nn.Unfold.html#torch.nn.Unfold)
4+
5+
```python
6+
torch.nn.Unfold(kernel_size, dilation=1, padding=0, stride=1)
7+
```
8+
9+
### [paddle.compat.nn.Unfold](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/nn/Unfold_cn.html#paddle/compat/nn/Unfold_cn#cn-api-paddle-compat-nn-Unfold)
10+
11+
```python
12+
paddle.compat.nn.Unfold(kernel_size, dilation=1, padding=0, stride=1)
13+
```
14+
15+
两者功能一致,但调用方式不一致,具体如下:
16+
17+
### 转写示例
18+
19+
```python
20+
# PyTorch 写法
21+
unfold = torch.nn.Unfold(kernel_size=(2, 2))
22+
23+
# Paddle 写法
24+
unfold = paddle.compat.nn.Unfold(kernel_size=(2, 2))
25+
26+
```

0 commit comments

Comments
 (0)