Skip to content

Conversation

izdeby
Copy link
Contributor

@izdeby izdeby commented May 21, 2019

This is the first part of the planned changes to change the comparison operations result tensor dtype from Byte to Bool. You can see the whole list of changes (not cleaned up) here. As the PR is too big for a single review im breaking it into pieces.

Changes in this PR:

  1. Enable these methods for bool tensors:
  • maskedSelect
  • maskedSelectBool
  • bitand
  • cbitand
  • bitor
  • cbitor
  • bitxor
  • cbitxor
  • sign
  • equal
  • neg
  1. Add bool clause for the TH version of sign method.

Everything except the TH sign method is just a code movement with no logic change.

@pytorchbot pytorchbot added module: build Build system issues module: cpu CPU specific problem (e.g., perf, algorithm) module: cuda Related to torch.cuda, and CUDA support in general module: internals Related to internal abstractions in c10 and ATen module: operators labels May 21, 2019
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.

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

@izdeby izdeby changed the title [WIP] Change comparison ops result dtype to bool Change comparison ops result dtype to bool May 21, 2019
@izdeby izdeby requested review from ezyang, gchanan and ilia-cher May 21, 2019 19:37
@izdeby izdeby changed the title Change comparison ops result dtype to bool Change comparison ops result dtype to bool [part 1] May 21, 2019
@ezyang
Copy link
Contributor

ezyang commented May 22, 2019

Consider using ghstack to submit these PRs? :)

scalar_t, tensor, *tensor_data, sum, UNCERTAIN_TH_OMP_OVERHEAD_THRESHOLD);
return sum;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Was the code in this block changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here and everywhere else in this PR, i just moved methods up above the #if !defined(TH_REAL_IS_BOOL) to enable them for bool.

@ezyang
Copy link
Contributor

ezyang commented May 22, 2019

The unified diff in this PR is being very unhelpful, because large chunks of code were moved around and the differ doesn't know how to play ball. I'm not sure how to solve this problem; at minimum, it would be helpful to call out where it was just code moved around, and where there were substantive changes (maybe all of this is just code movement?)

@ezyang
Copy link
Contributor

ezyang commented May 22, 2019

I don't see any tests in this PR?

@izdeby
Copy link
Contributor Author

izdeby commented May 22, 2019

@ezyang, good point on calling out what changes exactly were made. i specified which methods were touched but wasn't too clear about what exactly changed. Answering your question, yes it is only code move in this PR (except TH version of sign method, where i add check for bool scalar). Thats why i didnt add any tests as the logic didnt change.

@izdeby izdeby requested a review from ezyang May 22, 2019 20:38
Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

I assume in a later PR you will start actually exercising the bool paths.

zdevito pushed a commit to zdevito/ATen that referenced this pull request May 22, 2019
Summary:
This is the first part of the planned changes to change the comparison operations result tensor dtype from Byte to Bool. You can see the whole list of changes (not cleaned up) [here](pytorch/pytorch#19332). As the PR is too big for a single review im breaking it into pieces.

**Changes in this PR:**
1. Enable these methods for bool tensors:
- maskedSelect
- maskedSelectBool
- bitand
- cbitand
- bitor
- cbitor
- bitxor
- cbitxor
- sign
- equal
- neg

2. Add bool clause for the TH version of sign method.
Pull Request resolved: pytorch/pytorch#20767

Differential Revision: D15436446

Pulled By: izdeby

fbshipit-source-id: 8d2494b5f4873cd79c7f1a40d2cb045cadfad51a
@facebook-github-bot
Copy link
Contributor

@izdeby merged this pull request in 12bc81a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: build Build system issues module: cpu CPU specific problem (e.g., perf, algorithm) module: cuda Related to torch.cuda, and CUDA support in general module: internals Related to internal abstractions in c10 and ATen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants