data_reader.py 文件源码

python
阅读 39 收藏 0 点赞 0 评论 0

项目:DeepFFM 作者: waylensu 项目源码 文件源码
def read_and_decode(filename_queue):
    reader = tf.TFRecordReader()
    _, serialized_example = reader.read(filename_queue)
    features = tf.parse_single_example(
        serialized_example,
        features={
            'ind': tf.FixedLenFeature([], tf.string),
            'val': tf.FixedLenFeature([], tf.string),
            'label': tf.FixedLenFeature([], tf.int64),
        })

    ind = tf.decode_raw(features['ind'], tf.int32)
    val = tf.decode_raw(features['val'], tf.float32)

    ind.set_shape([39])
    val.set_shape([39])

    ind = tf.cast(ind, tf.int32)
    val = tf.cast(val, tf.float32)
    label = tf.cast(features['label'], tf.int64)

    return ind, val, label
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号