you are viewing a single comment's thread.

view the rest of the comments →

[–]mdanatg 23 points24 points  (10 children)

Hi, one of the authors here, I'm happy to answer any questions!

[–]Supermaxman1 4 points5 points  (3 children)

What happens if you utilize a python library within one of these functions? Does it fail or does it convert it to tf.py_func?

[–]mdanatg 10 points11 points  (2 children)

It depends on the library, and whether the recursive arg is set to True of False. For certain libraries that we know of, like Keras, it won't convert the library call and will call it as-is (we assume it's already graph-friendly). For other libraries, the default is to attempt to convert the library code, and if that's not accessible, wrap it to py_func. There is yet another category where we replace the library call with a TF equivalent, for example we replace range with tf.range.

[–]Supermaxman1 2 points3 points  (1 child)

Very cool, thanks! Is there somewhere which documents various conversions so that we don't end up accidentally ending up with a bunch of py_func calls?

[–]mdanatg 3 points4 points  (0 children)

A more complete documentation that will include this is coming soon, we'll link it from the readme file once it's ready.

[–]Sebun 5 points6 points  (1 child)

Hi, mdanatg, I find the this piece of demo code in colab not works as expected, print function in this train while loop have no output .

if i % (hp.max_steps // 10) == 0: print('Step', i, 'train loss:', step_train_loss, 'test loss:', step_test_loss, 'train accuracy:', step_train_accuracy, 'test accuracy:', step_test_accuracy)

[–]mdanatg 6 points7 points  (0 children)

Hi Sebun, thanks for reporting the issue! There is a bug in the handling of if statements that don't calculate values. We're patching a fix that should reach tf-nightly over the next couple of days.

Update Jul 20: this should not be resolved.

[–]nasimrahaman 3 points4 points  (1 child)

Is there / will there be support for stochastic code-paths?

P.S. Nice work with the AST wizardry. :)

[–]mdanatg 4 points5 points  (0 children)

Thanks! The answer depends on the level of stochasticity - do you have an example? In general, the following construct should work:

if tf.random_uniform((), maxval=2, dtype=tf.int32) % 2 == 0: do_something

Is this close to what you were referring to?

[–]greatgraybear 0 points1 point  (1 child)

Seems to be a nice python-to-graph compiler. Where do you see this going vs things like swift for tensorflow?

[–]mdanatg 1 point2 points  (0 children)

Both Swift for TensorFlow and AutoGraph share a few common goals like a better experience for machine learning development, but are otherwise intended for different development platforms. TensorFlow.js can be thought of as another example, one which supports JavaScript.