chore: fix type variance bug

This commit is contained in:
Shunsuke Shibayama 2024-01-28 23:12:48 +09:00
parent ccb54e0115
commit 6b5af0ffb4
3 changed files with 56 additions and 2 deletions

View file

@ -24,6 +24,27 @@
.NDArray(T, S)|<: Add .NDArray(T, S)|.
Output: {.NDArray(T, S)}
__add__: (self: .NDArray(T, S), other: .NDArray(T, S)) -> .NDArray(T, S)
.NDArray(T, S)|<: Add T|.
Output: {.NDArray(T, S)}
__add__: (self: .NDArray(T, S), other: T) -> .NDArray(T, S)
.NDArray(T, S)|<: Sub .NDArray(T, S)|.
Output: {.NDArray(T, S)}
__sub__: (self: .NDArray(T, S), other: .NDArray(T, S)) -> .NDArray(T, S)
.NDArray(T, S)|<: Sub T|.
Output: {.NDArray(T, S)}
__sub__: (self: .NDArray(T, S), other: T) -> .NDArray(T, S)
.NDArray(T, S)|<: Mul .NDArray(T, S)|.
Output: {.NDArray(T, S)}
__mul__: (self: .NDArray(T, S), other: .NDArray(T, S)) -> .NDArray(T, S)
.NDArray(T, S)|<: Mul T|.
Output: {.NDArray(T, S)}
__mul__: (self: .NDArray(T, S), other: T) -> .NDArray(T, S)
.NDArray(T, S)|<: Div .NDArray(T, S)|.
Output: {.NDArray(T, S)}
__div__: (self: .NDArray(T, S), other: .NDArray(T, S)) -> .NDArray(T, S)
.NDArray(T, S)|<: Div T|.
Output: {.NDArray(T, S)}
__div__: (self: .NDArray(T, S), other: T) -> .NDArray(T, S)
.NDArray.
shape: [Nat; _]
ndim: Nat
@ -61,3 +82,8 @@
.transpose: |T|(object: .NDArray(T), axes := [Nat; _]) -> .NDArray(T)
.zeros: (|N: Nat|(shape: {N}, dtype := Type) -> .NDArray(Nat, [N])) \
and (|S: [Nat; _]|(shape: {S}, dtype := Type) -> .NDArray(Nat, S))
.empty: (|N: Nat|(shape: {N}, dtype := Type) -> .NDArray(Nat, [N])) \
and (|S: [Nat; _]|(shape: {S}, dtype := Type) -> .NDArray(Nat, S))
.dot: (|T, I: Nat, J: Nat, K: Nat|(l: .NDArray(T, [I, J]), r: .NDArray(T, [J, K])) -> .NDArray(T, [I, K])) \
and (|T, I: Nat, J: Nat|(l: .NDArray(T, [I]), r: .NDArray(T, [I, J])) -> .NDArray(T, [J])) \
and (|T, I: Nat|(l: .NDArray(T, [I]), r: .NDArray(T, [I])) -> T)