Example #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))
Example #2
0
def OneFlow_int64_feature(value):
    """Generate OFRecord int64 Feature

    Args:
        value ([type]): Input 1D int Array

    Returns:
        [type]: OFRecord int64 Feature
    """
    if not isinstance(value, (list, tuple)):
        value = [value]
    return ofrecord.Feature(int64_list=ofrecord.Int64List(value=value))
 def create_int32_feature(values):
     return of_record.Feature(int32_list=of_record.Int32List(value=values)),
Example #4
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]))
Example #5
0
 def _double_feature(value):
     """Wrapper for inserting float features into Example proto."""
     if not isinstance(value, list):
         value = [value]
     return of_record.Feature(double_list=of_record.DoubleList(value=value))
Example #6
0
 def _int32_feature(value):
     """Wrapper for inserting int32 features into Example proto."""
     if not isinstance(value, list):
         value = [value]
     return of_record.Feature(int32_list=of_record.Int32List(value=value))
Example #7
0
def int32_feature(value):
    if not isinstance(value, (list, tuple)):
        value = [value]
    return ofrecord.Feature(int32_list=ofrecord.Int32List(value=value))
Example #8
0
def double_feature(value):
    if not isinstance(value, (list, tuple)):
        value = [value]
    return ofrecord.Feature(double_list=ofrecord.DoubleList(value=value))
Example #9
0
def float_feature(value):
    if not isinstance(value, (list, tuple)):
        value = [value]
    return ofrecord.Feature(float_list=ofrecord.FloatList(value=value))