Skip to content

Replace TemporaryFile() with io.BytesIO()#2376

Merged
karlhigley merged 1 commit intoOpenMined:masterfrom
Ankit-Dhankhar:serde_numpy
Jan 10, 2020
Merged

Replace TemporaryFile() with io.BytesIO()#2376
karlhigley merged 1 commit intoOpenMined:masterfrom
Ankit-Dhankhar:serde_numpy

Conversation

@Ankit-Dhankhar
Copy link
Contributor

Using similar syntax as torch_tensor_serializer/desearializer. #2357

Copy link
Contributor

@midokura-silvia midokura-silvia left a comment

Choose a reason for hiding this comment

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

Very nice improvement. Before merging, can you confirm me that there are unit tests for these functions? If not, can you please add some.

Copy link
Member

@kamathhrishi kamathhrishi left a comment

Choose a reason for hiding this comment

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

@midokura-silvia I don't think additional unit tests are required as tests for checking serialization already exists and they are passing with the proposed changes. What changes in this pr is how serialization is done.

@midokura-silvia
Copy link
Contributor

Ok, I just confirmed that there is a unit test. Could we improve the unit test by using @pytest.mark.parametrize and call it for let's say 4 different arrays? Some combination of float and int arrays, with non-symmetric dimensions? The current choice of numpy.ones((10, 10)) feels a bit limited.

@Ankit-Dhankhar
Copy link
Contributor Author

Sure I will add test cases.

@Ankit-Dhankhar
Copy link
Contributor Author

I have added test cases for random integer arrays of non-symmetric dimensions.
But for array with float value it is giving assert tensor_serialized[0] != serde.NO_COMPRESSION this false.

@Ankit-Dhankhar
Copy link
Contributor Author

I have added test-cases with requires_grad=True but tensor generated with torch.randn([dim]) fails this. Is this expected?

I have added test cases for random integer arrays of non-symmetric dimensions.
But for array with float value it is giving assert tensor_serialized[0] != serde.NO_COMPRESSION this false.

@robert-wagner robert-wagner self-assigned this Jul 30, 2019
@midokura-silvia
Copy link
Contributor

@robert-wagner any update from your side?

@robert-wagner robert-wagner changed the base branch from dev to master October 26, 2019 18:35
@iamtrask
Copy link
Member

@midokura-silvia - if it's been ~7 days or more after checking in with someone who reviewed - and you feel the PR should be approved - you may go ahead and merge.

@iamtrask
Copy link
Member

(in this case it's been 3 months - more than enough time)

@gmuraru
Copy link
Member

gmuraru commented Dec 13, 2019

Can I pick this up? @iamtrask

@karlhigley karlhigley dismissed robert-wagner’s stale review January 9, 2020 20:34

The requested changes have now been made.

@karlhigley
Copy link
Contributor

karlhigley commented Jan 9, 2020

@Ankit-Dhankhar I cloned your fork, squashed the commits in this PR, and rebased it on current PySyft master. You can see the resulting diff over here on the pr/2376 branch.

Sorry it's taken so long! Okay to force-push the result to your branch so we can finally get this PR merged? 😄

@karlhigley karlhigley merged commit f8604e3 into OpenMined:master Jan 10, 2020
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.

7 participants