def as_feature_spec(self, column):
if not column.is_fixed_size():
raise ValueError('A column of unknown size cannot be represented as '
'fixed-size.')
if column.domain.dtype not in _TF_EXAMPLE_ALLOWED_TYPES:
raise ValueError('tf.Example parser supports only types {}, so it is '
'invalid to generate a feature_spec with type '
'{}.'.format(
_TF_EXAMPLE_ALLOWED_TYPES,
repr(column.domain.dtype)))
return tf.FixedLenFeature(column.tf_shape().as_list(),
column.domain.dtype,
self.default_value)
评论列表
文章目录