Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize examples under more TensorFlow idioms #835

Merged
merged 6 commits into from
Jan 29, 2018

Conversation

dustinvtran
Copy link
Member

@dustinvtran dustinvtran commented Jan 28, 2018

This PR standardizes Edward examples to follow seven TensorFlow idioms:

  1. main() stores script code followed by tf.app.run();
  2. tf.flags for global configurations;
  3. tf.get_variable for variable definitions;
  4. tf.layers for neural net layers;
  5. net as the input/output variable name in layer compositions;
  6. Use (...) for multi-line variable assignments rather than \ ;
  7. In-place operators such as /= when possible.

Note. Some cases can be hard to find a consistent idiom. For example, official TF examples vary among absl, tf.flags, tf.app.flags, argparse; flags are added at both top of script and bottom within if __name__ == "__main__": clause; single quote vs double quotes for phrases; main(unused_argv) vs main(_).

I used my own judgments and worked off examples such as:

Note. I did not do anything to the code except perform the conversions. A future PR can follow more TensorFlow idioms. For example: rename flags to be self-documenting over Greek (e.g., batch_size overM); use broadcasting over explicit kwargs in random variables; sample_shape.

todos

  • update main pages
  • update examples/
  • update notebooks/ and docs/tex/
  • update tests/

@dustinvtran dustinvtran force-pushed the tensorflow/idioms branch 16 times, most recently from 62c5ba7 to 944d89e Compare January 29, 2018 04:47
@dustinvtran dustinvtran changed the title [WIP] Standardize examples under more TensorFlow idioms Standardize examples under more TensorFlow idioms Jan 29, 2018
@dustinvtran dustinvtran merged commit 4d6ed4c into master Jan 29, 2018
@dustinvtran dustinvtran deleted the tensorflow/idioms branch January 29, 2018 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant