diff --git a/auto_transformers.py b/auto_transformers.py index 0a601a2..496f989 100644 --- a/auto_transformers.py +++ b/auto_transformers.py @@ -212,7 +212,8 @@ class AutoTransformers(NNOperator): input_names=list(self.onnx_config['inputs'].keys()), output_names=list(self.onnx_config['outputs'].keys()), dynamic_axes=dynamic_axes, - opset_version=torch.onnx.constant_folding_opset_versions[-1], + opset_version=torch.onnx.constant_folding_opset_versions[-1] if hasattr( + torch.onnx, 'constant_folding_opset_versions') else 14, do_constant_folding=True, ) # todo: elif format == 'tensorrt':