Skip to content

Commit

Permalink
Fix Numpy NdArray type checking for Python 3.8. (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
balancap authored May 19, 2024
1 parent 85e2017 commit 68cf268
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions jax_scaled_arithmetics/core/datatype.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2023 Graphcore Ltd. All rights reserved.
from dataclasses import dataclass
from typing import Any, Optional, Union
from typing import TYPE_CHECKING, Any, Optional, Union

import jax
import jax.numpy as jnp
Expand All @@ -13,7 +13,10 @@
from .pow2 import Pow2RoundMode, pow2_decompose
from .typing import Array, ArrayTypes

GenericArray = Union[Array, np.ndarray[Any, Any]]
if TYPE_CHECKING:
GenericArray = Union[Array, np.ndarray[Any, Any]]
else:
GenericArray = Union[Array, np.ndarray]


@register_pytree_node_class
Expand Down

0 comments on commit 68cf268

Please sign in to comment.