def input_fn(tf_records_list, epochs=10, batch_size=8, n_frames=16):

    def _parse_proto(example_proto):
        parsed_dict = {'target': tf.FixedLenFeature((), tf.float32, default_value=0)}
        for i in range(n_frames):
            parsed_dict['frame_{}'.format(i)] = tf.FixedLenFeature((), tf.string, default_value='')
        parsed_features = tf.parse_single_example(example_proto, parsed_dict)
        return parsed_features

    def _split_xy(feat_dict):
        target = tf.one_hot(tf.to_int32(feat_dict['target']), depth=2, dtype=tf.float32)
        input_frames = {}
        for i in range(n_frames):
            frame_id = 'frame_{}'.format(i)
            input_frames[frame_id] = feat_dict[frame_id]
        return (input_frames, {'target': target})

    def _input_fn():
        dataset = tf.data.TFRecordDataset(tf_records_list, compression_type='GZIP')
        dataset = dataset.map(_parse_proto)
        dataset = dataset.map(_split_xy)
        dataset = dataset.shuffle(buffer_size=(2 * batch_size))
        dataset = dataset.repeat(epochs)
        dataset = dataset.batch(batch_size)
        return dataset
    return _input_fn
def input_fn(tf_records_list, epochs=10, batch_size=8, n_frames=16):

    def _parse_proto(example_proto):
        parsed_dict = {'target': tf.FixedLenFeature((), tf.float32, default_value=0)}
        for i in range(n_frames):
            parsed_dict['frame_{}'.format(i)] = tf.FixedLenFeature((), tf.string, default_value=)
        parsed_features = tf.parse_single_example(example_proto, parsed_dict)
        return parsed_features

    def _split_xy(feat_dict):
        target = tf.one_hot(tf.to_int32(feat_dict['target']), depth=2, dtype=tf.float32)
        input_frames = {}
        for i in range(n_frames):
            frame_id = 'frame_{}'.format(i)
            input_frames[frame_id] = feat_dict[frame_id]
        return (input_frames, {'target': target})

    def _input_fn():
        dataset = tf.data.TFRecordDataset(tf_records_list, compression_type='GZIP')
        dataset = dataset.map(_parse_proto)
        dataset = dataset.map(_split_xy)
        dataset = dataset.shuffle(buffer_size=(2 * batch_size))
        dataset = dataset.repeat(epochs)
        dataset = dataset.batch(batch_size)
        return dataset
    return _input_fn