Pysyft: Implement the Add function for IntTensor on the CPU/GPU

Created on 10 Jan 2018  路  10Comments  路  Source: OpenMined/PySyft

User Story:

As a Data Scientist using PySyft's IntTensor type, I want to leverage a wide range of methods which use our new Unity backend. For this ticket to be complete, the add() should be added to our IntTensor class with the appropriate functionality, returning a new tensor.

Note, it is possible that when you look in the code you'll find that parts of this issue were completed on the backend while implementing another issue. This is par for the course as features do not live in isolation. If this is the case, just take it as a convenience that someone already built that part and press on!

Every Reference You Might Need for this Issue:

  • For a reference on the operation this performs check out PyTorch's documentation.
  • For a reference on how to program in Unity, check out this basic tutorial
  • For a reference on how to write HLSL code, check out this basic tutorial
  • For a complete tutorial on how to add functions to FloatTensor (step by step guide) see this Google Document
  • For a reference on how other functions like this have been implemented check out the functions in this notebook as well as the corresponding files that made it possible (SyftController, FloatTensor.Ops, FloatTensor.ShaderOps, FloatTensorShaders, and FloatTensorTest).
  • And of course, please consider our Contributor Guidelines for all contributions.

    Acceptance Criteria:

  • [ ] comment below that you're interested in picking up this issue

  • [ ] an example in a notebook in our tests folder showing how to use the functionality from PySyft
  • [ ] an integration test in PySyft demonstrating the correct CPU and GPU operation implemented over an IntTensor while connected to a Unity backend
  • [ ] a Unit Test in OpenMined/OpenMined demonstrating the correct operation on a FloatTensor
  • [ ] [inline](http://pytorch.org/docs/master/tensors.html) documentation in the python code. For inspiration on inline documentation, please check out PyTorch's documentation for this operator.
  • [ ] Link your Pull Request back to this Issue so that it gets closed appropriately when the PR is merged.
Good first issue Help Wanted Type

Most helpful comment

Hey @gavinuhma , in https://github.com/OpenMined/OpenMined/pull/322 I uncovered a potential bug in how our shader is initialized which I will report in another bug issue. This implementation does pass your first unit test with a temporary workaround.

All 10 comments

While the title says to implement in the IntTensor class, description says add() should be added to our FloatTensor class! I think it is in IntTensor in both cases. Please correct me if I am wrong.

@dikshant2210 you are right! sorry about that. it is intTensor in both the cases.

I'll pick this one up

Going to start with the PySyft interface and the CPU code

Sweet! Once you've got the interface setup, I'll add the GPU side. Feel free to just add an if statement that returns "NotImplementException" if dataOnGpu==True and I'll insert my GPU code there (wherever you'd like it).

Perfect. Works for me!

Hey @gavinuhma , what branch are you working on so that I can collaborate with you?

Hey @iamtrask I'm working from int_add, I started a pull request as a work in progress:
https://github.com/OpenMined/OpenMined/pull/319

Hey @gavinuhma , in https://github.com/OpenMined/OpenMined/pull/322 I uncovered a potential bug in how our shader is initialized which I will report in another bug issue. This implementation does pass your first unit test with a temporary workaround.

Great find @iamtrask ! We're almost done!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LaRiffle picture LaRiffle  路  3Comments

iamtrask picture iamtrask  路  3Comments

MetaT1an picture MetaT1an  路  3Comments

mgale694 picture mgale694  路  3Comments

swaroopch picture swaroopch  路  4Comments