Skip to content

Implement reduce keyword for SmoothL1Loss#3382

Merged
soumith merged 2 commits intopytorch:masterfrom
zou3519:smoothl1loss-reduce-keyword
Nov 1, 2017
Merged

Implement reduce keyword for SmoothL1Loss#3382
soumith merged 2 commits intopytorch:masterfrom
zou3519:smoothl1loss-reduce-keyword

Conversation

@zou3519
Copy link
Copy Markdown
Contributor

@zou3519 zou3519 commented Oct 30, 2017

As per #264. When reduce is False, SmoothL1Loss outputs a loss per element of the input tensor. When reduce is True (default), the current behavior is kept.

Test Plan

test/run_test.sh
Added unit test for the reduce=False case. Also added a reference function to the reduce=True unit test.

@zou3519
Copy link
Copy Markdown
Contributor Author

zou3519 commented Oct 30, 2017

@pytorchbot retest this please

Copy link
Copy Markdown
Contributor

@apaszke apaszke left a comment

Choose a reason for hiding this comment

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

Looks good. Exactly the same comments as in the L1Loss PR.

Comment thread test/test_nn.py Outdated

This comment was marked as off-topic.

Comment thread torch/lib/THCUNN/SmoothL1Criterion.cu Outdated

This comment was marked as off-topic.

Comment thread torch/lib/THCUNN/SmoothL1Criterion.cu Outdated

This comment was marked as off-topic.

Comment thread torch/lib/THCUNN/SmoothL1Criterion.cu Outdated

This comment was marked as off-topic.

This comment was marked as off-topic.

@zou3519 zou3519 force-pushed the smoothl1loss-reduce-keyword branch from da97795 to ff46126 Compare October 31, 2017 16:25
@soumith soumith merged commit bf4c269 into pytorch:master Nov 1, 2017
fmassa added a commit to fmassa/pytorch that referenced this pull request Mar 7, 2018
This has been present in master since pytorch#3382 but the doc for the functional interface was not taken into account.
ezyang pushed a commit that referenced this pull request Mar 7, 2018
This has been present in master since #3382 but the doc for the functional interface was not taken into account.
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
* Implement reduce keyword for SmoothL1Loss
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
This has been present in master since pytorch#3382 but the doc for the functional interface was not taken into account.
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.

3 participants