Skip to content

convert lambd directly to scalar_t at hardshrink#9919

Closed
weiyangfb wants to merge 3 commits intopytorch:masterfrom
weiyangfb:hardshrink_scalar
Closed

convert lambd directly to scalar_t at hardshrink#9919
weiyangfb wants to merge 3 commits intopytorch:masterfrom
weiyangfb:hardshrink_scalar

Conversation

@weiyangfb
Copy link
Contributor

  • convert lambd directly to scalar_t instead of creating a tensor

scalar_t& self_val,
scalar_t& out_tensor_val) {
out_tensor_val = (self_val >= -*lambd_tensor_d && self_val <= *lambd_tensor_d) ? convert<scalar_t, int>(0) : self_val;
out_tensor_val = (self_val >= -lambd.to<scalar_t>() && self_val <= lambd.to<scalar_t>()) ? convert<scalar_t, int>(0) : self_val;

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Collaborator

@ssnl ssnl left a comment

Choose a reason for hiding this comment

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

LGTM :)

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.

weiyangfb 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.

weiyangfb is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@weiyangfb weiyangfb deleted the hardshrink_scalar branch July 27, 2018 20:26
zdevito pushed a commit to zdevito/ATen that referenced this pull request Jul 27, 2018
Summary:
- convert lambd directly to scalar_t instead of creating a tensor
Pull Request resolved: pytorch/pytorch#9919

Differential Revision: D9026708

Pulled By: weiyangfb

fbshipit-source-id: d20ab06ecc12aa972ee9d1323ee2f84abf8d5ffd
jramseyer pushed a commit to jramseyer/pytorch that referenced this pull request Jul 30, 2018
Summary:
- convert lambd directly to scalar_t instead of creating a tensor
Pull Request resolved: pytorch#9919

Differential Revision: D9026708

Pulled By: weiyangfb

fbshipit-source-id: d20ab06ecc12aa972ee9d1323ee2f84abf8d5ffd
goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
Summary:
- convert lambd directly to scalar_t instead of creating a tensor
Pull Request resolved: pytorch#9919

Differential Revision: D9026708

Pulled By: weiyangfb

fbshipit-source-id: d20ab06ecc12aa972ee9d1323ee2f84abf8d5ffd
@ezyang ezyang added the merged label Jun 26, 2019
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.

4 participants