Standardize examples under more TensorFlow idioms #835
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR standardizes Edward examples to follow seven TensorFlow idioms:
main()
stores script code followed bytf.app.run()
;tf.flags
for global configurations;tf.get_variable
for variable definitions;tf.layers
for neural net layers;net
as the input/output variable name in layer compositions;(...)
for multi-line variable assignments rather than\
;/=
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)
vsmain(_)
.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
examples/
notebooks/
anddocs/tex/
tests/