@ -29,31 +29,32 @@ __all__ = ['DataFeeder']
def convert_dtype ( dtype ) :
if isinstance ( dtype , str ) :
if dtype in [
' float32' , ' int64 ' , ' float64 ' , ' float 1 6' , ' int 32' , ' uint8 ' ,
' bool '
' bool' , ' float16 ' , ' float32 ' , ' float 64 ' , ' int 8' , ' int16 ' ,
' int32' , ' int64 ' , ' uint8 '
] :
return dtype
else :
raise ValueError (
" dtype must be any of [bool, int32, float32, int64, "
" float64, uint8] " )
elif dtype == core . VarDesc . VarType . BOOL :
return ' bool '
elif dtype == core . VarDesc . VarType . FP32 :
return ' float32 '
elif dtype == core . VarDesc . VarType . INT64 :
return ' int64 '
elif dtype == core . VarDesc . VarType . FP64 :
return ' float64 '
elif dtype == core . VarDesc . VarType . FP16 :
return ' float16 '
elif dtype == core . VarDesc . VarType . INT32 :
return ' int32 '
elif dtype == core . VarDesc . VarType . UINT8 :
return ' uint8 '
else :
raise ValueError ( " dtype must be any of [bool,int32, float32, int64, "
" float64, uint8] " )
if dtype == core . VarDesc . VarType . BOOL :
return ' bool '
elif dtype == core . VarDesc . VarType . FP16 :
return ' float16 '
elif dtype == core . VarDesc . VarType . FP32 :
return ' float32 '
elif dtype == core . VarDesc . VarType . FP64 :
return ' float64 '
elif dtype == core . VarDesc . VarType . INT8 :
return ' int8 '
elif dtype == core . VarDesc . VarType . INT16 :
return ' int16 '
elif dtype == core . VarDesc . VarType . INT32 :
return ' int32 '
elif dtype == core . VarDesc . VarType . INT64 :
return ' int64 '
elif dtype == core . VarDesc . VarType . UINT8 :
return ' uint8 '
raise ValueError (
" dtype must be any of [bool, float16, float32, float64, int8, int16, "
" int32, int64, uint8] " )
class DataToLoDTensorConverter ( object ) :