From bf241b4e27ad7f13009c9b719450f651c6a78e9d Mon Sep 17 00:00:00 2001 From: Patrick Kidger <33688385+patrick-kidger@users.noreply.github.com> Date: Fri, 3 Mar 2023 10:32:26 -0800 Subject: [PATCH] We now have e.g. `Float[Array, ""] <: Array`. --- jaxtyping/array_types.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jaxtyping/array_types.py b/jaxtyping/array_types.py index 595fcfd..49dc63e 100644 --- a/jaxtyping/array_types.py +++ b/jaxtyping/array_types.py @@ -17,6 +17,7 @@ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +import abc import enum import functools as ft import typing @@ -460,6 +461,9 @@ class _MetaAbstractDtype(type): out = Union[out] else: out = _make(array_type) + # So that `issubclass(Float[Array, ""], Array) == True`. + if isinstance(array_type, abc.ABCMeta): + array_type.register(out) return out