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

logical and bitwise functions #427

Merged
merged 17 commits into from
Jan 15, 2020
Merged

logical and bitwise functions #427

merged 17 commits into from
Jan 15, 2020

Conversation

mtar
Copy link
Collaborator

@mtar mtar commented Dec 9, 2019

Description

Fixes: #225 #226, improves #366

Changes proposed:

  • Implementation of the logical functions (and, not, or, not)
  • Implementation of bitwise functions (invert/not, left/right shift)
  • Removing binary_bit_op and other functions in operations.py introduced in Bit-wise AND OR XOR #366
  • infer tensor type from torch result instead of operands in binary_op.

Type of change

[x] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] Documentation update

Are all split configurations tested and accounted for?
[x] yes [ ] no
Does this change require a documentation update outside of the changes proposed?
[ ] yes [x] no
Does this change modify the behaviour of other functions?
[ ] yes [x] no
Are there code practices which require justification?
[ ] yes [x] no

@codecov
Copy link

codecov bot commented Dec 9, 2019

Codecov Report

Merging #427 into master will decrease coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #427      +/-   ##
==========================================
- Coverage   96.68%   96.65%   -0.03%     
==========================================
  Files          57       57              
  Lines       12142    12107      -35     
==========================================
- Hits        11739    11702      -37     
- Misses        403      405       +2
Impacted Files Coverage Δ
heat/core/tests/test_arithmetics.py 98.44% <ø> (ø) ⬆️
heat/core/tests/test_operations.py 92.64% <ø> (-3.01%) ⬇️
heat/core/tests/test_dndarray.py 99.24% <100%> (+0.01%) ⬆️
heat/core/statistics.py 96.33% <100%> (ø) ⬆️
heat/core/version.py 85.71% <100%> (ø) ⬆️
heat/core/operations.py 94.52% <0%> (-1.37%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af325dc...77c585b. Read the comment docs.

@coquelin77
Copy link
Member

@mtar i am going to need you to merge the master with this one. you know this code better than i

heat/core/arithmetics.py Outdated Show resolved Hide resolved
heat/core/arithmetics.py Outdated Show resolved Hide resolved
heat/core/arithmetics.py Outdated Show resolved Hide resolved
heat/core/arithmetics.py Outdated Show resolved Hide resolved
heat/core/logical.py Show resolved Hide resolved
heat/core/logical.py Show resolved Hide resolved
heat/core/operations.py Outdated Show resolved Hide resolved
heat/core/operations.py Show resolved Hide resolved
@@ -276,6 +255,32 @@ def test_fmod(self):
with self.assertRaises(TypeError):
ht.fmod("T", "s")

def test_invert(self):
int_tensor = ht.array([[0, 1], [2, -2]])
Copy link
Member

Choose a reason for hiding this comment

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

can you add one test to all of these with a different int datatype? i.e. int16 or something like that

@mtar mtar requested a review from coquelin77 January 15, 2020 09:01
@coquelin77 coquelin77 merged commit 5c9a3d2 into master Jan 15, 2020
@coquelin77 coquelin77 deleted the features/bitwiselogicalops branch January 15, 2020 09:14
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.

Implement logical binary operators
2 participants