Skip to content

Commit

Permalink
add conditional import to ensure backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ifsheldon committed Aug 9, 2022
1 parent 248b00b commit 26231ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/stannum/tube.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import torch
from taichi.lang.impl import axes
from typing import Optional, Callable, Union, Tuple, List, Iterable, Dict, Any
from .utils import to_taichi_type, need_auto_clearing_fields
from taichi._lib.core.taichi_python import DataType as TiDataType
from .utils import to_taichi_type, need_auto_clearing_fields, TiDataType
from taichi.lang.field import ScalarField
from taichi.lang.matrix import MatrixField
from functools import partial
Expand Down
6 changes: 5 additions & 1 deletion src/stannum/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
from taichi.lang.kernel_impl import Kernel
from taichi.lang.matrix import MatrixField
from taichi.lang.field import ScalarField
from taichi._lib.core.taichi_python import DataType as TiDataType

if __ti_version >= (1, 1, 0):
from taichi._lib.core.taichi_python import DataType as TiDataType
else:
from taichi._lib.core.taichi_core import DataType as TiDataType
import torch
import taichi as ti

Expand Down

0 comments on commit 26231ad

Please sign in to comment.