def bytes_feature(value): if not isinstance(value, (list, tuple)): value = [value] if not six.PY2: if isinstance(value[0], str): value = [x.encode() for x in value] return ofrecord.Feature(bytes_list=ofrecord.BytesList(value=value))
def _bytes_feature(value): """Wrapper for inserting bytes features into Example proto.""" # if isinstance(value, six.string_types): # value = six.binary_type(value, encoding='utf-8') return of_record.Feature(bytes_list=of_record.BytesList(value=[value]))