FIX Return invalid dtype when MPC is applied #4035
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Issue:
this was the original issue #3982 raised there was a mismatch in dtype after using the share()
Reason:
The create_wrapper class which was used to create the wrapper was returning tensor with a dtype torch.float32.
Fix
sending the
type=self.dtype
as a parameter inshared_tensor.wrap()
from theshare()
solves the issue.wrap()
function calls another functionsy.framework.hook.create_wrapper(type, **kwargs)
which is appended belowin
create_wrapper(cls, wrapper_type)
function if wrapper_type is None we gettorch.Tensor()
in return which is by default of dtypetorch.float32
(which is our issue). This was easily fixed by sending the dtype from theshare()
fucntion which ultimatly reaches tocreate_wrapper(cls, wrapper_type)
and sets the dtype.This pull request closes #3982
Affected Dependencies
None
How has this been tested?
one new test case has been added in
test_share_get()
function of thetest_additive_shared.py
file.Checklist