def _create_sequence_features(self):
sequences = {}
for feature, feature_type in self.meta_data['sequence_features_types'].items():
if feature_type == 'int':
sequences[feature] = tf.FixedLenSequenceFeature([], dtype=tf.int64)
elif feature_type == 'float':
sequences[feature] = tf.FixedLenSequenceFeature([], dtype=tf.float32)
elif feature_type == 'bytes':
sequences[feature] = tf.FixedLenSequenceFeature([], dtype=tf.string)
else:
raise TypeError("The feature type `{}` is not supported.".format({feature_type}))
return sequences
评论列表
文章目录