Skip to content

Commit e73c536

Browse files
authored
[FxImporter] make FxImporter to fit python<=3.9 (#2802)
As that torch with py3.9 is also used widely.
1 parent 2ef2283 commit e73c536

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/torch_mlir/extras/fx_importer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
# Also available under a BSD-style license. See LICENSE.
77

8+
try:
9+
from types import NoneType
10+
except ImportError:
11+
# python less than 3.10 doesn't have NoneType
12+
NoneType = type(None)
13+
814
import logging
915
import operator
1016
import re
11-
from types import NoneType, BuiltinMethodType, BuiltinFunctionType
17+
from types import BuiltinMethodType, BuiltinFunctionType
1218
from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Union
1319
import weakref
1420

0 commit comments

Comments
 (0)