Created
April 20, 2020 23:28
-
-
Save jjh42/d2b824e42e54e99dce5a84d387c88b8d to your computer and use it in GitHub Desktop.
Recipe for converting some nested numpy (or similar structure) to tensorflow types.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
example_tf = tf.nest.map_structure( | |
tf.nest.map_structure(tf.convert_to_tensor, example)) | |
output_types = tf.nest.map_structure(lambda t: t.dtype, tf_example) | |
output_shapes = tf.nest.map_structure(tf.nest.map_structure( | |
lambda t: t.shape.as_list(), tf_example)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment