Skip to content

Conversation

@ailzhang
Copy link
Contributor

Fixes #12129 , #12327
cc: @fmassa _pointwise_loss is currently only called by l1_loss, mse_loss and smooth_l1_loss which all makes sense to have broadcast.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

reduction = _Reduction.get_enum(reduction)
return torch._C._nn.smooth_l1_loss(input, target, reduction)
reduction = _Reduction.legacy_get_string(size_average, reduce)
return _pointwise_loss(

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@ailzhang
Copy link
Contributor Author

@pytorchbot retest this please

@ssnl ssnl closed this Oct 24, 2018
@ssnl ssnl reopened this Oct 24, 2018
return torch._C._nn.smooth_l1_loss(input, target, reduction)
reduction = _Reduction.legacy_get_string(size_average, reduce)
return _pointwise_loss(
lambda a, b: torch.where(torch.abs(a - b) < 1, 0.5 * (torch.abs(a - b)) ** 2, torch.abs(a - b) - 0.5),

This comment was marked as off-topic.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@ssnl
Copy link
Collaborator

ssnl commented Oct 25, 2018

can we have a test?

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

test/test_nn.py Outdated
# When target.requires_grad=True, its impl is in Python, while the other is in TH.
target = torch.ones(2, 10, requires_grad=requires_grad)
l = fn(input, target, 'none')
self.assertEqual(l.size(), target.size())

This comment was marked as off-topic.

@ailzhang ailzhang closed this Oct 26, 2018
@ailzhang ailzhang reopened this Oct 26, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

test/test_nn.py Outdated
for requires_grad in (True, False):
# When target.requires_grad=True, its impl is in Python, while the other is in TH.
target = torch.randn(2, 10, requires_grad=requires_grad)
l = fn(input, target, 'none')

This comment was marked as off-topic.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot pushed a commit that referenced this pull request Oct 31, 2018
Summary: Fixes #12129 , #12327

Differential Revision: D10513781

Pulled By: ailzhang

fbshipit-source-id: a210008a39ff6c3f056c9fbe3f0576cfcce638ec
@ailzhang
Copy link
Contributor Author

This has been landed to master, not sure why it didn't get closed tho. Closing manually.

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.

5 participants