Repository: OpenMined/PySyft

Issue:
Implement the Eq function for IntTensor on the CPU
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 eq() should be added to our IntTensor class with the appropriate functionality, returning a new tensor.

If you want to take it to the next level, boost it implementing the operation on the GPU: Search for an issue titled like this but with "on the GPU" on the title!
                       HLSL (GPU language) tutorial here: [Direct Compute Programming Guide](https://github.com/OpenMined/OpenMined/blob/master/tutorials/DirectCompute_Programming_Guide.md)

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 normal 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](http://pytorch.org/docs/master/tensors.html)'s documentation.
- For a reference on how to program in Unity, check out [this basic tutorial](https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial)
- For a reference on how to write HLSL code, check out [this basic tutorial](http://kylehalladay.com/blog/tutorial/2014/06/27/Compute-Shaders-Are-Nifty.html)
- For a complete tutorial on how to add functions to FloatTensor (step by step guide) see [this Google Document](https://docs.google.com/document/d/1WRd7gGLFN0Awtf86AICYIHtg3gfFWLBa5wYTthsB3i0/edit)
- For a reference on how other functions like this have been implemented check out the functions in [this notebook](https://github.com/OpenMined/OpenMined/blob/master/notebooks/Syft%20Tensor%20Example%20Notebook.ipynb) as well as the corresponding files that made it possible ([SyftController](https://github.com/OpenMined/OpenMined/blob/master/UnityProject/Assets/OpenMined/Network/Controllers/SyftController.cs), [FloatTensor.Ops](https://github.com/OpenMined/OpenMined/blob/master/UnityProject/Assets/OpenMined/Syft/Tensor/FloatTensor.Ops.cs), [FloatTensorShaders](https://github.com/OpenMined/OpenMined/blob/master/UnityProject/Assets/OpenMined/Syft/Tensor/Ops/Shaders/FloatTensorShaders.compute), [TensorOpsShaders](https://github.com/OpenMined/OpenMined/blob/master/UnityProject/Assets/OpenMined/Syft/Tensor/Ops/Shaders/TensorOpsShaders.compute), [FloatTensorTest](https://github.com/OpenMined/OpenMined/blob/master/UnityProject/Assets/OpenMined.Tests/Editor/FloatTensor/FloatTensorTest.cs) and [FloatTensorGpuTest](https://github.com/OpenMined/OpenMined/blob/master/UnityProject/Assets/OpenMined.Tests/Editor/FloatTensor/FloatTensorGpuTest.cs)).
- And of course, please consider our [Contributor Guidelines](https://github.com/OpenMined/Docs/blob/master/contributing/guidelines.md) for all contributions.

### Acceptance Criteria:

- [ ] comment below that you're picking up this project
- [ ] an example in a notebook in our [tests folder](https://github.com/OpenMined/OpenMined/tree/master/notebooks/tests) showing how to use the functionality from PySyft
- [ ] an integration test in PySyft demonstrating the correct CPU 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.


Discussion:
i'll take this up! 

this will be my first contribution :p

-nico

Resolving patch:
diff --git a/syft/tensor.py b/syft/tensor.py
--- a/syft/tensor.py
+++ b/syft/tensor.py
@@ -337,6 +337,30 @@ def lt_(self, other):
         """
         return self.params_func("lt_", [other.id], return_response=True)
 
+    def eq(self, other):
+        """
+        Determines whether 'other' (IntTensor) has the same elements as self (IntTensor).
+
+        parameters:
+            other: IntTensor, of the same dimension as self
+        returns: IntTensor, with values
+            1 - when the elements are equal
+            0 - when the elements are not equal
+        """
+        return self.params_func("eq", [other.id], return_response=True)
+
+    def eq_(self, other):
+        """
+        Determines whether 'other' (IntTensor) has the same elements as self (IntTensor).
+
+        parameters:
+            other: IntTensor, of the same dimension as self
+        returns: IntTensor, with values
+            1 - when the elements are equal
+            0 - when the elements are not equal
+        """
+        return self.params_func("eq_", [other.id], return_response=True)
+
     def equal(self, x):
         """
         Determines whether the given tensor has the same size and elements as this instance.
@@ -361,7 +385,7 @@ def neg(self):
             Output tensor
         """
         return self.no_params_func("neg", return_response=True)
-    
+
     def neg_(self):
         """
         Sets negative of the elements of tensor inplace.
@@ -407,7 +431,7 @@ def reciprocal(self):
             Output Tensor
         """
         return self.no_params_func("reciprocal", return_response=True)
-    
+
     def reciprocal_(self):
         """
         Computes reciprocal of input tensor with values inplace.
@@ -419,7 +443,7 @@ def reciprocal_(self):
             Caller with values inplace
         """
         return self.no_params_func("reciprocal_")
-      
+
     def trace(self):
         """
         Returns a new tensor with the sum along diagonals of a 2D tensor.
@@ -441,7 +465,7 @@ def sin(self):
             Output Tensor
         """
         return self.no_params_func("sin", return_response=True, return_type='FloatTensor');
-      
+
     def __repr__(self, verbose=True):
 
         tensor_str = str(self.to_numpy())


Test patch: