Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implement neg for all types#4075

Merged
colesbury merged 2 commits into
pytorch:masterfrom
colesbury:neg
Dec 7, 2017
Merged

Implement neg for all types#4075
colesbury merged 2 commits into
pytorch:masterfrom
colesbury:neg

Conversation

@colesbury
Copy link
Copy Markdown
Member

@colesbury colesbury commented Dec 7, 2017

The C/C++ unary negation operator is well defined for unsigned types. We
should use that behavior. This also implements neg for CharTensor. That
behavior currently depends on whether char is signed or unsigned.

Fixes #4066, #3225

The C/C++ unary negation operator is well defined for unsigned types. We
should use that behavior. This also implements neg for CharTensor. That
behavior currently depends on whether char is signed or unsigned.

Fixes pytorch#4066
@pytorchbot
Copy link
Copy Markdown
Collaborator

@colesbury, thanks for your PR! We identified @zdevito to be a potential reviewer.

Comment thread test/test_torch.py
@staticmethod
def _test_neg(self, cast):
float_types = ['torch.DoubleTensor', 'torch.FloatTensor', 'torch.LongTensor']
int_types = ['torch.IntTensor', 'torch.ShortTensor']

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Copy Markdown
Contributor

@gchanan gchanan left a comment

Choose a reason for hiding this comment

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

lgtm.

@pietern
Copy link
Copy Markdown
Contributor

pietern commented Dec 7, 2017

There was some CI maintenance happening this morning -- retriggering build.

@pytorchbot retest this please

@colesbury colesbury merged commit 9ea576d into pytorch:master Dec 7, 2017
@colesbury colesbury deleted the neg branch December 7, 2017 21:37
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
The C/C++ unary negation operator is well defined for unsigned types. We
should use that behavior. This also implements neg for CharTensor. That
behavior currently depends on whether char is signed or unsigned.

Fixes pytorch#4066, pytorch#3225
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