@@ -346,9 +346,9 @@ def convert_precision_string(cls, precision):
346346
347347 @classmethod
348348 def _convert_ap_type (cls , precision ):
349- '''
349+ """
350350 Convert a precision string (e.g. "ap_fixed<16,6>" to the internal FixedPrecisionTypes etc)
351- '''
351+ """
352352 bits = re .search ('.+<(.+?)>' , precision ).group (1 ).split (',' )
353353 sat_mode = None
354354 round_mode = None
@@ -357,12 +357,12 @@ def _convert_ap_type(cls, precision):
357357 width = int (bits [0 ])
358358 integer = int (bits [1 ])
359359 fields = 2
360- signed = not ( 'u' in precision )
360+ signed = 'u' not in precision
361361 elif 'int' in precision :
362362 width = int (bits [0 ])
363363 integer = width
364364 fields = 1
365- signed = not ( 'u' in precision )
365+ signed = 'u' not in precision
366366 if len (bits ) > fields :
367367 round_mode = bits [fields ]
368368 if len (bits ) > fields + 1 :
@@ -376,9 +376,9 @@ def _convert_ap_type(cls, precision):
376376
377377 @classmethod
378378 def _convert_ac_type (cls , precision ):
379- '''
379+ """
380380 Convert a precision string (e.g. "ac_fixed<16,6>" to the internal FixedPrecisionTypes etc)
381- '''
381+ """
382382 bits = re .search ('.+<(.+?)>' , precision ).group (1 ).split (',' )
383383 signed = True # default is signed
384384 sat_mode = None
@@ -414,18 +414,18 @@ def _convert_ac_type(cls, precision):
414414
415415 @classmethod
416416 def _convert_auto_type (cls , precision ):
417- '''
417+ """
418418 Convert a "auto" precision string into the UnspecifiedPrecisionType
419- '''
419+ """
420420 return UnspecifiedPrecisionType ()
421421
422422 def product_type (self , data_T , weight_T ):
423- '''
423+ """
424424 Helper function to determine which product implementation to use during inference
425- '''
426- assert not isinstance (
427- data_T , ExponentPrecisionType
428- ), "Only ExponentPrecisionType (aka 'power of 2') weights are currently supported, not data."
425+ """
426+ assert not isinstance (data_T , ExponentPrecisionType ), (
427+ "Only ExponentPrecisionType (aka 'power of 2') weights are currently supported, not data."
428+ )
429429 product = 'mult'
430430 if isinstance (weight_T , ExponentPrecisionType ):
431431 product = 'weight_exponential'
@@ -754,14 +754,14 @@ def generate_conv1d_line_buffer_fn(self, layer_idx, n_partitions, in_W, in_C, ke
754754 im2col_matrix = self ._compute_conv1d_im2col ((in_W , in_C ), kernel , stride , (pad_left , pad_right ), dilation )
755755
756756 generated_code = (
757- " template<class data_T, typename CONFIG_T>\n "
758- " class fill_buffer_{index} : public nnet::FillConv1DBuffer<data_T, CONFIG_T> {{\n "
759- " public:\n "
760- " static void fill_buffer(\n "
761- " data_T data[CONFIG_T::in_width * CONFIG_T::n_chan],\n "
762- " data_T buffer[CONFIG_T::n_pixels][CONFIG_T::filt_width * CONFIG_T::n_chan],\n "
763- " const unsigned partition\n "
764- " ) {{\n "
757+ ' template<class data_T, typename CONFIG_T>\n '
758+ ' class fill_buffer_{index} : public nnet::FillConv1DBuffer<data_T, CONFIG_T> {{\n '
759+ ' public:\n '
760+ ' static void fill_buffer(\n '
761+ ' data_T data[CONFIG_T::in_width * CONFIG_T::n_chan],\n '
762+ ' data_T buffer[CONFIG_T::n_pixels][CONFIG_T::filt_width * CONFIG_T::n_chan],\n '
763+ ' const unsigned partition\n '
764+ ' ) {{\n '
765765 ).format (index = layer_idx )
766766 indent = ' '
767767
@@ -884,14 +884,14 @@ def generate_conv2d_line_buffer_fn(
884884 )
885885
886886 generated_code = (
887- " template<class data_T, typename CONFIG_T>\n "
888- " class fill_buffer_{index} : public nnet::FillConv2DBuffer<data_T, CONFIG_T> {{\n "
889- " public:\n "
890- " static void fill_buffer(\n "
891- " data_T data[CONFIG_T::in_height * CONFIG_T::in_width * CONFIG_T::n_chan],\n "
892- " data_T buffer[CONFIG_T::n_pixels][CONFIG_T::filt_height * CONFIG_T::filt_width * CONFIG_T::n_chan],\n "
893- " const unsigned partition\n "
894- " ) {{\n "
887+ ' template<class data_T, typename CONFIG_T>\n '
888+ ' class fill_buffer_{index} : public nnet::FillConv2DBuffer<data_T, CONFIG_T> {{\n '
889+ ' public:\n '
890+ ' static void fill_buffer(\n '
891+ ' data_T data[CONFIG_T::in_height * CONFIG_T::in_width * CONFIG_T::n_chan],\n '
892+ ' data_T buffer[CONFIG_T::n_pixels][CONFIG_T::filt_height * CONFIG_T::filt_width * CONFIG_T::n_chan],\n '
893+ ' const unsigned partition\n '
894+ ' ) {{\n '
895895 ).format (index = layer_idx )
896896 indent = ' '
897897
0 commit comments