File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 9
9
import importlib
10
10
import inspect
11
11
from itertools import chain
12
+ import sys
12
13
import warnings
13
14
14
15
import numpy as np
15
16
import tensorflow as tf
16
17
from tensorflow .python .framework .tensor_util import MakeNdarray
17
18
from tensorflow .core .framework .attr_value_pb2 import AttrValue
18
19
20
+ # Define long type for Python 3:
21
+ if sys .version_info > (3 ,):
22
+ long = int
23
+
19
24
from onnx_tf .common import (
20
25
TF_TYPE_TO_ONNX_TYPE ,
21
26
TF_OP_STR_TO_ONNX_OP ,
@@ -234,7 +239,7 @@ def tensorflow_graph_to_onnx_graph(cls,
234
239
opset_dict [domain ] = version
235
240
defs .ONNX_DOMAIN = domain
236
241
assert isinstance (
237
- version , int
242
+ version , ( int , long )
238
243
) and (version <= defs .onnx_opset_version ()) and (
239
244
version >= 0
240
245
), "Opset should be an int less than or equal to {}, but {}: {}" .format (
@@ -412,10 +417,10 @@ def get_node_by_name(nodes, name):
412
417
413
418
assert isinstance (
414
419
opset ,
415
- (int , list ,
420
+ (int , long , list ,
416
421
tuple )), "opset is expected to int, list or tuple, but {}." .format (
417
422
type (opset ))
418
- if isinstance (opset , int ):
423
+ if isinstance (opset , ( int , long ) ):
419
424
if opset == 0 :
420
425
opset = defs .onnx_opset_version ()
421
426
opset = [("" , opset )]
You can’t perform that action at this time.
0 commit comments