OpenMined / Threepio

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

Top-level functions are shadowed by sub-module funcs #109

Closed vvmnnnkv closed 4 years ago

vvmnnnkv commented 4 years ago

Description

I've noticed that in torch -> tfjs conversion, tf.reshape is overridden by tf.layers.reshape, which has different arguments. Correct translation would be torch.reshape -> tf.reshape, but tf.layers.reshape has same key in the funcs map and overwrites tf.reshape when the map is populated. I'm trying to solve that by giving priority to functions that has shorter attrs path.

This kinda works, but it seems the problem needs more correct fix that would keep both funcs in the map but differentiate them by sub-module on mapping time?

Affected Dependencies

n/a

How has this been tested?

Unit tests

Checklist

Nolski commented 4 years ago

This is related to #16

vvmnnnkv commented 4 years ago

Noticed issue in tfjs parsed .json file: e.g. if you see tf.GraphModel in tfjs API, it's methods are listed w/o tf.GraphModel. prefix. Doc parser doesn't add tf.GraphModel prefix, so all these methods appear as is they were in global scope. I'm going to manually remove "add" from tfjs/1.5.1.json because it interferes with tf.add(), but will create separate issue to fix doc parser.

vvmnnnkv commented 4 years ago

Separate ticket: https://github.com/OpenMined/Threepio/issues/113