@@ -70,7 +70,7 @@ def activation_function(activation, opts):
7070 ("%.10f" % opts ['pwlPoints' ][0 ])), tabs = 1 ) + \
7171 utils .write_ret ((utils .toFxp (0.0 , opts ) \
7272 if opts ['useFxp' ] else \
73- "0.0 " ), tabs = 2 ) + \
73+ "0.0f " ), tabs = 2 ) + \
7474 utils .write_end (tabs = 1 )
7575
7676 # Internal points
@@ -93,7 +93,7 @@ def activation_function(activation, opts):
9393 pwlCode += utils .write_else (tabs = 1 ) + \
9494 utils .write_ret ((utils .toFxp (1.0 , opts ) \
9595 if opts ['useFxp' ] else \
96- "1.0 " ), tabs = 2 ) + \
96+ "1.0f " ), tabs = 2 ) + \
9797 utils .write_end (tabs = 1 )
9898
9999 return pwlCode
@@ -106,18 +106,18 @@ def activation_function(activation, opts):
106106 ", fxp_div(x, fxp_sum(" + \
107107 utils .toFxp (1.0 , opts ) + ", my_abs(x)))))" ) \
108108 if opts ['useFxp' ] else \
109- "0.5 * (x / (1.0 + my_abs(x))) + 0.5 " )
109+ "0.5f * (x / (1.0f + my_abs(x))) + 0.5f " )
110110 else :
111111 # Using original sigmoid function
112112 funcCode = (("fxp_div(" + utils .toFxp (1.0 , opts ) + \
113113 ", fxp_sum(" + utils .toFxp (1.0 , opts ) + \
114114 ", fxp_exp(-x)))" )\
115115 if opts ['useFxp' ] else \
116- "1.0 / (1.0 + expf(-x))" )
116+ "1.0f / (1.0f + expf(-x))" )
117117 elif activation == 'relu' :
118118 funcCode = (("max(" + utils .toFxp (0 , opts ) + ", x)" )\
119119 if opts ['useFxp' ] else \
120- "max(0.0 , x)" )
120+ "max(0.0f , x)" )
121121 else :
122122 print ("Activation function " + activation + " not supported!" )
123123 exit (1 )
@@ -277,7 +277,6 @@ def write_output(classifier, opts):
277277 utils .write_define ("my_abs(x)" , "(((x) > (0.0)) ? (x) : -(x))" )
278278
279279 # Include of libraries
280- incls += utils .write_include ("<Arduino.h>" )
281280 if opts ['useFxp' ]:
282281 incls += utils .write_define ("TOTAL_BITS" , str (opts ['totalBits' ])) + \
283282 utils .write_define ("FIXED_FBITS" , str (opts ['fracBits' ])) + \
0 commit comments