Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #517: torch.all #534

Merged
merged 1 commit into from
Feb 8, 2016
Merged

Fix for issue #517: torch.all #534

merged 1 commit into from
Feb 8, 2016

Conversation

ivpopov
Copy link
Contributor

@ivpopov ivpopov commented Feb 4, 2016

Fix for "torch.all only returns true if all numbers in the tensor are odd #517"


TENSOR_IMPLEMENT_LOGICAL_SUM(logicalall, &=, 1)
TENSOR_IMPLEMENT_LOGICAL_SUM(logicalany, |=, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it not sufficient to change &= to && and |= to || here? This would use the correct logical operators rather than bitwise operators. sum would probably need to be a bool in this case.

@ivpopov
Copy link
Contributor Author

ivpopov commented Feb 4, 2016

I am not sure I understand your suggestion. &= and |= assign to the left operand. && and || do not.

@ivpopov
Copy link
Contributor Author

ivpopov commented Feb 4, 2016

After discussing with Tim that there is no hidden magic in using |= instead of logical ||, changing macros and operators to sum = sum OP ... and && and ||

@soumith
Copy link
Member

soumith commented Feb 4, 2016

squash your commits and this is good to merge. thnx

torch.all only returns true if all numbers in the tensor are odd torch#517

Update THTensorMath.c

Respective test
@ivpopov
Copy link
Contributor Author

ivpopov commented Feb 8, 2016

Done

@soumith
Copy link
Member

soumith commented Feb 8, 2016

@ivpopov still dont see a squash. did you force-push back to the same PR?

soumith added a commit that referenced this pull request Feb 8, 2016
@soumith soumith merged commit d606ee9 into torch:master Feb 8, 2016
@soumith
Copy link
Member

soumith commented Feb 8, 2016

Thanks!

colesbury pushed a commit to colesbury/torch7 that referenced this pull request Nov 3, 2016
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