File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,36 @@ def to_numpy_dt(self):
144144 def get_canonical_name (self ):
145145 return "FLOAT32"
146146
147+ class Float16Type (BaseDataType ):
148+ def bitwidth (self ):
149+ return 16
150+
151+ def min (self ):
152+ return np .finfo (np .float16 ).min
153+
154+ def max (self ):
155+ return np .finfo (np .float16 ).max
156+
157+ def allowed (self , value ):
158+ return True
159+
160+ def get_num_possible_values (self ):
161+ raise Exception ("Undefined for Float16Type" )
162+
163+ def is_integer (self ):
164+ return False
165+
166+ def is_fixed_point (self ):
167+ return False
168+
169+ def get_hls_datatype_str (self ):
170+ return "float"
171+
172+ def to_numpy_dt (self ):
173+ return np .float16
174+
175+ def get_canonical_name (self ):
176+ return "FLOAT16"
147177
148178class IntType (BaseDataType ):
149179 def __init__ (self , bitwidth , signed ):
@@ -349,6 +379,7 @@ def resolve_datatype(name):
349379 "BIPOLAR" : BipolarType (),
350380 "TERNARY" : TernaryType (),
351381 "FLOAT32" : FloatType (),
382+ "FLOAT16" : Float16Type (),
352383 }
353384 if name in _special_types .keys ():
354385 return _special_types [name ]
You can’t perform that action at this time.
0 commit comments