Skip to content

Commit be0f062

Browse files
author
channingss
committed
add check torch version
1 parent 7670fee commit be0f062

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

x2paddle/decoder/onnx_decoder.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,15 @@ def get_dynamic_shape_from_caffe2(self, layer, input_shapes):
461461
"""
462462
get dynamic shape from caffe2.backend
463463
"""
464+
try:
465+
import torch
466+
version = torch.__version__
467+
if '1.1.0' not in version:
468+
print("torch==1.1.0 is required")
469+
return
470+
except:
471+
print("onnx is not installed, use \"pip install torch==1.1.0\".")
472+
return
464473
from caffe2.python.onnx.backend import prepare
465474
shape = input_shapes[0]
466475
np_images = np.random.rand(shape[0], shape[1], shape[2],

0 commit comments

Comments
 (0)