Skip to content

Instantly share code, notes, and snippets.

@tgamauf
Last active March 17, 2018 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgamauf/69ec66a1257c00ee6765841c4286c1dd to your computer and use it in GitHub Desktop.
Save tgamauf/69ec66a1257c00ee6765841c4286c1dd to your computer and use it in GitHub Desktop.
Use of tf.train.FeatureList
movie_1_actors = tf.train.Feature(
bytes_list=tf.train.BytesList(
value=[b'Tim Robbins', b'Morgan Freeman']))
movie_2_actors = tf.train.Feature(
bytes_list=tf.train.BytesList(
value=[b'Brad Pitt', b'Edward Norton', b'Helena Bonham Carter']))
movie_actors_list = [movie_1_actors, movie_2_actors]
movie_actors = tf.train.FeatureList(feature=movie_actors_list)
# Short form
movie_names = tf.train.FeatureList(feature=[
tf.train.Feature(bytes_list=tf.train.BytesList(
value=[b'The Shawshank Redemption', b'Fight Club']))
])
movie_ratings = tf.train.FeatureList(feature=[
tf.train.Feature(float_list=tf.train.FloatList(
value=[9.7, 9.0]))
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment