Skip to content
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
Expand Up @@ -26,6 +26,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -48,7 +49,7 @@ paddle.nn.BCELoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.BCELoss(size_average=False)
torch.nn.BCELoss(reduce=True)

# Paddle 写法
paddle.nn.BCELoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -51,7 +52,7 @@ paddle.nn.BCEWithLogitsLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.BCEWithLogitsLoss(size_average=False)
torch.nn.BCEWithLogitsLoss(reduce=True)

# Paddle 写法
paddle.nn.BCEWithLogitsLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -44,7 +45,7 @@ paddle.nn.CosineEmbeddingLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.CosineEmbeddingLoss(size_average=False)
torch.nn.CosineEmbeddingLoss(reduce=True)

# Paddle 写法
paddle.nn.CosineEmbeddingLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -59,7 +60,7 @@ paddle.nn.CrossEntropyLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.CrossEntropyLoss(size_average=False)
torch.nn.CrossEntropyLoss(reduce=True)

# Paddle 写法
paddle.nn.CrossEntropyLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -49,7 +50,7 @@ paddle.nn.HingeEmbeddingLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.HingeEmbeddingLoss(size_average=False)
torch.nn.HingeEmbeddingLoss(reduce=True)

# Paddle 写法
paddle.nn.HingeEmbeddingLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -47,7 +48,7 @@ paddle.nn.KLDivLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.KLDivLoss(size_average=False)
torch.nn.KLDivLoss(reduce=True)

# Paddle 写法
paddle.nn.KLDivLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -45,7 +46,7 @@ paddle.nn.L1Loss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.L1Loss(size_average=False)
torch.nn.L1Loss(reduce=True)

# Paddle 写法
paddle.nn.L1Loss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -44,7 +45,7 @@ paddle.nn.MSELoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.MSELoss(size_average=False)
torch.nn.MSELoss(reduce=True)

# Paddle 写法
paddle.nn.MSELoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -49,7 +50,7 @@ paddle.nn.MarginRankingLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.MarginRankingLoss(size_average=False)
torch.nn.MarginRankingLoss(reduce=True)

# Paddle 写法
paddle.nn.MarginRankingLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -43,7 +44,7 @@ paddle.nn.MultiLabelMarginLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.MultiLabelMarginLoss(size_average=False)
torch.nn.MultiLabelMarginLoss(reduce=True)

# Paddle 写法
paddle.nn.MultiLabelMarginLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -44,7 +45,7 @@ paddle.nn.MultiLabelSoftMarginLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.MultiLabelSoftMarginLoss(size_average=False)
torch.nn.MultiLabelSoftMarginLoss(reduce=True)

# Paddle 写法
paddle.nn.MultiLabelSoftMarginLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -46,7 +47,7 @@ paddle.nn.MultiMarginLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.MultiMarginLoss(size_average=False)
torch.nn.MultiMarginLoss(reduce=True)

# Paddle 写法
paddle.nn.MultiMarginLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -52,7 +53,7 @@ paddle.nn.NLLLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.NLLLoss(size_average=False)
torch.nn.NLLLoss(reduce=True)

# Paddle 写法
paddle.nn.NLLLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -46,7 +47,7 @@ paddle.nn.PoissonNLLLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.PoissonNLLLoss(size_average=False)
torch.nn.PoissonNLLLoss(reduce=True)

# Paddle 写法
paddle.nn.PoissonNLLLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -50,7 +51,7 @@ paddle.nn.SmoothL1Loss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.SmoothL1Loss(size_average=False)
torch.nn.SmoothL1Loss(reduce=True)

# Paddle 写法
paddle.nn.SmoothL1Loss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -46,7 +47,7 @@ paddle.nn.SoftMarginLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.SoftMarginLoss(size_average=False)
torch.nn.SoftMarginLoss(reduce=True)

# Paddle 写法
paddle.nn.SoftMarginLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -47,7 +48,7 @@ paddle.nn.TripletMarginLoss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.TripletMarginLoss(size_average=False)
torch.nn.TripletMarginLoss(reduce=True)

# Paddle 写法
paddle.nn.TripletMarginLoss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ paddle.nn.functional.binary_cross_entropy(input, label, weight=None, reduction='

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -46,7 +47,7 @@ paddle.nn.functional.binary\_cross\_entropy(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.functional.binary_cross_entropy(size_average=False)
torch.nn.functional.binary_cross_entropy(reduce=True)

# Paddle 写法
paddle.nn.functional.binary\_cross\_entropy(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -47,7 +48,7 @@ paddle.nn.functional.binary_cross_entropy_with_logits(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.functional.binary_cross_entropy_with_logits(size_average=False)
torch.nn.functional.binary_cross_entropy_with_logits(reduce=True)

# Paddle 写法
paddle.nn.functional.binary_cross_entropy_with_logits(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -47,7 +48,7 @@ paddle.nn.functional.cosine_embedding_loss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.functional.cosine_embedding_loss(size_average=False)
torch.nn.functional.cosine_embedding_loss(reduce=True)

# Paddle 写法
paddle.nn.functional.cosine_embedding_loss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ paddle.nn.functional.cross_entropy(input,

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -66,7 +67,7 @@ paddle.nn.functional.cross_entropy(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.functional.cross_entropy(size_average=False)
torch.nn.functional.cross_entropy(reduce=True)

# Paddle 写法
paddle.nn.functional.cross_entropy(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -46,7 +47,7 @@ paddle.nn.functional.hinge_embedding_loss(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.functional.hinge_embedding_loss(size_average=False)
torch.nn.functional.hinge_embedding_loss(reduce=True)

# Paddle 写法
paddle.nn.functional.hinge_embedding_loss(reduction='sum')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ paddle.nn.functional.kl_div(input,

### 转写示例


#### size_average
size_average 为 True
```python
Expand All @@ -52,7 +53,7 @@ paddle.nn.functional.kl_div(reduction='sum')
reduce 为 True
```python
# PyTorch 写法
torch.nn.functional.kl_div(size_average=False)
torch.nn.functional.kl_div(reduce=True)

# Paddle 写法
paddle.nn.functional.kl_div(reduction='sum')
Expand Down
Loading