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

Removed wrap() on non-tensor pointers in respond_to_search() #3685

Merged
merged 12 commits into from
Jun 14, 2020

Conversation

AlanAboudib
Copy link
Contributor

Description

in syft/workers/message_handlers:respond_to_search(), all pointers are wrapped before being returned. This should be the case only on PointerTensor objects, not only all pointers.

This causes a fail in SyferText where we need to exchange object pointers that are not tensors.

Affected Dependencies

None

How has this been tested?

All existing tests

Checklist

@AlanAboudib AlanAboudib requested a review from a team as a code owner June 9, 2020 12:30
@AlanAboudib AlanAboudib self-assigned this Jun 9, 2020
@AlanAboudib AlanAboudib added Priority: 1 - Immediate 🔥 Must be fixed immediately and cannot wait Severity: 1 - Critical 🔥 Causes a failure of the complete software system, subsystem or a program within the system Type: Bug 🐛 Some functionality not working in the codebase as intended labels Jun 9, 2020
# Wrap only if the pointer points to a tensor.
# If it points to a generic object, do not wrap.
if isinstance(obj, PointerTensor):
ptr.wrap()
Copy link
Member

Choose a reason for hiding this comment

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

Q: if you remove this if completely are the tests failing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just pushed that to test

Copy link
Member

Choose a reason for hiding this comment

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

Yeah...it is failling :(, it was ok before 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted my changes and it still giving an error :O

Copy link
Member

Choose a reason for hiding this comment

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

@AlanAboudib it seemed to be an intermittent and was not the result of your change.It was happening because of timeout when waiting for an async response. I re-ran the tests and all tests passed. You can make your change and then we can debug further if the issue happens again.

Copy link
Member

Choose a reason for hiding this comment

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

I think @shubham3121 referred to the changes with

    # Wrap only if the pointer points to a tensor.
            # If it points to a generic object, do not wrap.
            if isinstance(obj, PointerTensor):
                ptr.wrap()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying your idea of just remove .wrap() without adding my code. I just push my changes back now

Copy link
Member

Choose a reason for hiding this comment

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

@AlanAboudib , Ques: You want to wrap Tensor objects (not necessarily PointerTensors objects) and not non Tensor objects, is that the behaviour you're looking for ??
If so, then the check should be isinstance(obj, torch.Tensor). Because the currently the test is failing because the obj is an Tensor instance and not a PointerTensor object, as a result we are not wrapping it and hence results in error on calling .shape.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, my bad, I actually wanted to type:

if isinstance(ptr, PointerTensor):

Your solution works too. I will do

Thank you so much

Copy link
Member

Choose a reason for hiding this comment

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

@AlanAboudib ptr.wrap() should prt = ptr.wrap() as it is not an inline operation.

@codecov
Copy link

codecov bot commented Jun 9, 2020

Codecov Report

Merging #3685 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3685      +/-   ##
==========================================
+ Coverage   94.77%   94.80%   +0.03%     
==========================================
  Files         184      185       +1     
  Lines       18231    18339     +108     
==========================================
+ Hits        17278    17387     +109     
+ Misses        953      952       -1     
Impacted Files Coverage Δ
syft/workers/message_handler.py 91.66% <100.00%> (+0.10%) ⬆️
syft/generic/pointers/pointer_dataset.py 75.00% <0.00%> (-1.09%) ⬇️
syft/generic/pointers/pointer_plan.py 75.43% <0.00%> (-0.88%) ⬇️
test/torch/tensors/test_fv.py 100.00% <0.00%> (ø)
test/torch/tensors/test_additive_shared.py 100.00% <0.00%> (ø)
syft/frameworks/torch/he/fv/evaluator.py 96.96% <0.00%> (ø)
...frameworks/torch/tensors/interpreters/precision.py 97.25% <0.00%> (+0.05%) ⬆️
...orks/torch/tensors/interpreters/additive_shared.py 94.35% <0.00%> (+0.11%) ⬆️
syft/frameworks/torch/he/fv/util/operations.py 95.32% <0.00%> (+0.18%) ⬆️
syft/execution/plan.py 94.70% <0.00%> (+1.24%) ⬆️

# Wrap only if the pointer points to a tensor.
# If it points to a generic object, do not wrap.
if isinstance(obj, PointerTensor):
ptr.wrap()
Copy link
Member

Choose a reason for hiding this comment

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

@AlanAboudib ptr.wrap() should prt = ptr.wrap() as it is not an inline operation.

Copy link
Member

@shubham3121 shubham3121 left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@shubham3121 shubham3121 merged commit 15f9945 into master Jun 14, 2020
@delete-merged-branch delete-merged-branch bot deleted the alan_debug branch June 14, 2020 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 1 - Immediate 🔥 Must be fixed immediately and cannot wait Severity: 1 - Critical 🔥 Causes a failure of the complete software system, subsystem or a program within the system Type: Bug 🐛 Some functionality not working in the codebase as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants