File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -355,9 +355,11 @@ def _interpolate_functional_flops_hook(*args, **kwargs):
355355
356356 if size is not None :
357357 if isinstance (size , tuple ) or isinstance (size , list ):
358- return int (np .prod (size , dtype = np .int64 ))* np .prod (input .shape [:2 ], dtype = np .int64 )
358+ return int (np .prod (size , dtype = np .int64 )) * \
359+ np .prod (input .shape [:2 ], dtype = np .int64 )
359360 else :
360- return int (size ) ** (input .dim () - 2 ) * np .prod (input .shape [:2 ], dtype = np .int64 )
361+ return int (size ) ** (input .dim () - 2 ) * \
362+ np .prod (input .shape [:2 ], dtype = np .int64 )
361363
362364 scale_factor = kwargs .get ('scale_factor' , None )
363365 if scale_factor is None and len (args ) > 2 :
@@ -368,8 +370,8 @@ def _interpolate_functional_flops_hook(*args, **kwargs):
368370 flops = input .numel ()
369371 if isinstance (scale_factor , tuple ) and len (scale_factor ) == len (input .shape ) - 2 :
370372 flops *= int (np .prod (scale_factor , dtype = np .int64 ))
371- else :
372- flops *= scale_factor ** (input .dim () - 2 ) # NC... layout is assumed, see interpolate docs
373+ else : # NC... layout is assumed, see interpolate docs
374+ flops *= scale_factor ** (input .dim () - 2 )
373375
374376 return flops
375377
You can’t perform that action at this time.
0 commit comments