admin管理员组文章数量:1650772
模型加载TFRecords文件时一直报这个错误。
tensorflow.python.framework.errors_impl.InvalidArgumentError: Feature: feature (data type: string) i
提示的是feature对应的数据的类型不对,原来是由于生成TFRecords文件指定的key跟读取时的key不同导致的,好吧,那个s被我吃了,细节决定成败。
# 生成文件时的key是features
example = tf.train.Example(features=tf.train.Features(feature={
"label": tf.train.Feature(int64_list=tf.train.Int64List(value=[click])),
"features": tf.train.Feature(bytes_list=tf.train.BytesList(value=[feature]))
}))
# 读取文件时使用的key也应该是features,而不是feature.
features = {
'label': tf.FixedLenFeature([], tf.int64),
'feature': tf.FixedLenFeature([], tf.string)
}
本文标签: featureInvalidArgumentErrorDatarequired
版权声明:本文标题:InvalidArgumentError: Feature: feature (data type: string) is required but could not be found. 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1729533532a1205119.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论