Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and taichi-gardener committed Jun 22, 2024
1 parent d2a0365 commit 15cf000
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions python/taichi/lang/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,16 @@ def to_pytorch_type(dt):
return torch.uint8
if dt == f16:
return torch.float16

if dt in (u16, u32, u64):
if hasattr(torch, "uint16"):
if dt == u16:
return torch.uint16
if dt == u32:
return torch.uint32
if dt == u64:
return torch.uint64
raise RuntimeError(f"PyTorch doesn't support {dt.to_string()} data type before version 2.3.0.")
if hasattr(torch, "uint16"):
if dt == u16:
return torch.uint16
if dt == u32:
return torch.uint32
if dt == u64:
return torch.uint64
raise RuntimeError(f"PyTorch doesn't support {dt.to_string()} data type before version 2.3.0.")

raise RuntimeError(f"PyTorch doesn't support {dt.to_string()} data type.")
assert False
Expand Down Expand Up @@ -276,18 +276,17 @@ def to_taichi_type(dt):
return u8
if dt == torch.float16:
return f16

if hasattr(torch, "uint16"):
if dt == torch.uint16:
return u16
if dt == torch.uint32:
return u32
if dt == torch.uint64:
return u64
if dt == torch.uint16:
return u16
if dt == torch.uint32:
return u32
if dt == torch.uint64:
return u64

raise RuntimeError(f"PyTorch doesn't support {dt.to_string()} data type before version 2.3.0.")


if has_paddle():
import paddle # pylint: disable=C0415

Expand Down

0 comments on commit 15cf000

Please sign in to comment.