예제 #1
0
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))
예제 #2
0
 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]))