OpenMined / Threepio

A multi-language library for translating commands between PyTorch, TensorFlow, and TensorFlow.js
Other
56 stars 15 forks source link

Add translation: Beta [pytorch -> tfjs] #93

Open Nolski opened 4 years ago

Nolski commented 4 years ago

Description

Add command translation from pytorch Beta to tensorflow.js randomGamma

Are you interested in working on this improvement yourself?

Prtfw commented 4 years ago

some breadcrumbs for implementation as per @Nolski

Okay so here's my thought, the issue is that randomGamma is two commands in pytorch. b = torch.Beta(...) b.sample()

There's currently no way to translate 2 commands into one using only Threepio

What you can do, if Beta is absolutely needed in the demo, is patch PySyft translation and manually check to see if Beta is being translated.

That would be here: https://github.com/Nolski/PySyft/blob/feat/multi-command-translation/syft/execution/translation/threepio.py#L56

You would want to check that to_lang is tfjs and that the function_name is Beta Then you would splice out the two actions and register a single action in the new role which is randomGamma with the correct args.