(serialized_example)
return {
      # add [0] after "value" if you want to just get value "1" instead of ["1"]
      'class': np.reshape(eg.features.feature['class'].int64_list.value,
                          [1]).astype(np.int64).tolist(),
      'seq_len': eg.features.feature['seq_len'].int64_list.value[0],
      'sequence': np.reshape(eg.features.feature['sequence'].float_list.value,
                             [51*10]).astype(np.float32).tolist(),
      'rendered': np.reshape(eg.features.feature['rendered'].float_list.value,
                             [64*64]).astype(np.float32).tolist(),
  }
Decodes saved, serialized tfrecord example.
Decodes saved, serialized tfrecord example.
Decodes saved serialized tfrecord example .
def _decode_tfexample(serialized_example):
  """Decodes saved, serialized tfrecord example."""
  eg = tf.train.Example.FromString(serialized_example)
  return {
      # add [0] after "value" if you want to just get value "1" instead of ["1"]
      'class': np.reshape(eg.features.feature['class'].int64_list.value,
                          [1]).astype(np.int64).tolist(),
      'seq_len': eg.features.feature['seq_len'].int64_list.value[0],
      'sequence': np.reshape(eg.features.feature['sequence'].float_list.value,
                             [51*10]).astype(np.float32).tolist(),
      'rendered': np.reshape(eg.features.feature['rendered'].float_list.value,
                             [64*64]).astype(np.float32).tolist(),
  }
def _decode_tfexample ( serialized_example ) : eg = tf . train . Example . FromString ( serialized_example ) return { # add [0] after "value" if you want to just get value "1" instead of ["1"] 'class' : np . reshape ( eg . features . feature [ 'class' ] . int64_list . value , [ 1 ] ) . astype ( np . int64 ) . tolist ( ) , 'seq_len' : eg . features . feature [ 'seq_len' ] . int64_list . value [ 0 ] , 'sequence' : np . reshape ( eg . features . feature [ 'sequence' ] . float_list . value , [ 51 * 10 ] ) . astype ( np . float32 ) . tolist ( ) , 'rendered' : np . reshape ( eg . features . feature [ 'rendered' ] . float_list . value , [ 64 * 64 ] ) . astype ( np . float32 ) . tolist ( ) , }