PyDP icon indicating copy to clipboard operation
PyDP copied to clipboard

Test datatype for when passed for compuation

Open chinmayshah99 opened this issue 4 years ago • 4 comments

Description

When we call the result function, we just pass the python list as it is.

x = pydp.BoundedMean(1.0)
x.result([1,2,3,4])

What would be great is mention the datatype of the list in another argument, x.result([1,2,3,4], 'int') We want the new function definition to have the datatype as one of the argument, with float as the default argument. Note: The function definition of result below is for representation purpose and the original code will be in c++ (pybind11).

def result(list, datatype= 'float'): 
  pass

The idea behind doing this is if we know the datatype, the underlying c++ code can become a lot efficient as right now, we are just converting everything to float.

chinmayshah99 avatar Jul 28 '20 21:07 chinmayshah99

Are we planning to do this for every function ?

codeboy5 avatar Jul 29 '20 12:07 codeboy5

Yes

On Wed, 29 Jul 2020 at 18:28, Saksham [email protected] wrote:

Are we planning to do this for every function ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OpenMined/PyDP/issues/204#issuecomment-665647901, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTTOFMGXH4GOEEYZE5AP3LR6AMGJANCNFSM4PK6LODQ .

-- Regards

Chinmay Shah

chinmayshah99 avatar Jul 30 '20 08:07 chinmayshah99

I can take this up, I will try to add them for the util functions first and we can expand from it If everything works as expected .

codeboy5 avatar Aug 01 '20 07:08 codeboy5

We have already added datatype in #249 . We just need to make sure we do the cast, at the same time raise a warning.

chinmayshah99 avatar Aug 17 '20 21:08 chinmayshah99