@@ -253,7 +253,7 @@ def to_jit(self, *values, **kwargs):
253253 """
254254self .info ("+" ,"to_jit" ,args = values ,kwargs = kwargs )
255255annotations = self .f .__annotations__
256- if len ( annotations ) > 0 :
256+ if annotations :
257257input_to_kwargs = {}
258258kwargs_to_input = {}
259259names = list (annotations .keys ())
@@ -352,10 +352,10 @@ def to_jit(self, *values, **kwargs):
352352if iname in constraints
353353 ]
354354names = [i .name for i in inputs ]
355- if len ( new_kwargs ) > 0 :
355+ if new_kwargs :
356356# An attribute is not named in the numpy API
357357# but is the ONNX definition.
358- if len ( kwargs ) == 0 :
358+ if not kwargs :
359359kwargs = new_kwargs
360360else :
361361kwargs = kwargs .copy ()
@@ -375,13 +375,13 @@ def to_jit(self, *values, **kwargs):
375375target_opsets = self .target_opsets ,
376376ir_version = self .ir_version ,
377377 )
378- if len ( values ) > 0 and len ( values [0 ].shape ) == 0 :
378+ if values and not values [0 ].shape :
379379inps = onx .graph .input [0 ]
380380shape = []
381381for d in inps .type .tensor_type .shape .dim :
382382v = d .dim_value if d .dim_value > 0 else d .dim_param
383383shape .append (v )
384- if len ( shape ) != 0 :
384+ if shape :
385385raise RuntimeError (
386386f"Shape mismatch, values[0]={ values [0 ]} "
387387f"and inputs={ onx .graph .input } ."
@@ -441,7 +441,7 @@ def move_input_to_kwargs(
441441f"self.input_to_kwargs_ is not initialized for function{ self .f } "
442442f"from module{ self .f .__module__ !r} ."
443443 )
444- if len ( self .input_to_kwargs_ ) == 0 :
444+ if not self .input_to_kwargs_ :
445445return values ,kwargs
446446new_values = []
447447new_kwargs = kwargs .copy ()