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 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)),
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]))
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))
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))
def int32_feature(value): if not isinstance(value, (list, tuple)): value = [value] return ofrecord.Feature(int32_list=ofrecord.Int32List(value=value))
def double_feature(value): if not isinstance(value, (list, tuple)): value = [value] return ofrecord.Feature(double_list=ofrecord.DoubleList(value=value))
def float_feature(value): if not isinstance(value, (list, tuple)): value = [value] return ofrecord.Feature(float_list=ofrecord.FloatList(value=value))