def read(filename_queue, feature_num=2, dtypes=[list, int]):
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
feature_dict={}
for i in range(feature_num):
# here, only three data types are allowed: tf.float32, tf.int64, tf.string
if dtypes[i] is int:
feature_dict['feature'+str(i+1)]=tf.FixedLenFeature([], tf.int64)
else:
feature_dict['feature'+str(i+1)]=tf.FixedLenFeature([], tf.string)
features = tf.parse_single_example(
serialized_example,
features=feature_dict)
return features
#======================================================================================
## test code
big_input.py 文件源码
python
阅读 38
收藏 0
点赞 0
评论 0
评论列表
文章目录