我正在使用Tensorflow v1.3 中的 Dataset API。这很棒。可以使用此处描述的函数映射数据集。我很想知道如何传递具有附加参数的函数,例如arg1
:
def _parse_function(example_proto, arg1):
features = {"image": tf.FixedLenFeature((), tf.string, default_value=""),
"label": tf.FixedLenFeature((), tf.int32, default_value=0)}
parsed_features = tf.parse_single_example(example_proto, features)
return parsed_features["image"], parsed_features["label"]
当然,
dataset = dataset.map(_parse_function)
行不通,因为没有办法通过arg1
。