fix: overload resolution bug

This commit is contained in:
Shunsuke Shibayama 2024-02-09 14:33:58 +09:00
parent 66352ddd3a
commit 21d5f22ca8
5 changed files with 30 additions and 1 deletions

View file

@ -1,3 +1,5 @@
np = pyimport "numpy"
.backends = pyimport "./backends"
.cuda = pyimport "./cuda"
.nn = pyimport "./nn"
@ -33,9 +35,17 @@
.Tensor!(T, S)|<: IrregularEq|.
Output: {Tensor!(Bool, S)}
__eq__: (self: .Tensor!(T, S), other: .Tensor!(T, S)) -> .Tensor!(Bool, S)
.Tensor!(T, S)|<: Indexable(Nat, .Tensor!(T, _))|.
__getitem__: (self: .Tensor!(T, S), index: Nat or [Nat; _]) -> .Tensor!(T, _)
.Tensor!(T, S).
data: .Tensor!(T, S)
.Tensor!(_, _).
dtype: .DType
shape: .Size
clone: |T, S: [Nat; _]|(self: .Tensor!(T, S)) -> .Tensor!(T, S)
cpu: |T, S: [Nat; _]|(self: .Tensor!(T, S)) -> .Tensor!(T, S)
detach: |T, S: [Nat; _]|(self: .Tensor!(T, S)) -> .Tensor!(T, S)
numpy: |T, S: [Nat; _]|(self: .Tensor!(T, S)) -> np.NDArray(T, S)
view: (|T, Old: [Nat; _], S: {A: [Nat; _] | A.prod() == Old.prod()}|(
self: .Tensor!(T, Old),
shape: {S},
@ -64,6 +74,7 @@
and (|T|(self: .Tensor!(T, _), dim: Nat) -> .Tensor!(T, _))
.relu: |T, S: [Nat; _]|(x: .Tensor!(T, S)) -> .Tensor!(T, S)
.softmax: |T, S: [Nat; _]|(x: .Tensor!(T, S), dim: Nat) -> .Tensor!(T, S)
.max: (|T|(input: .Tensor!(T, _), dim: Nat, keepdim := Bool) -> (.Tensor!(T, _)), .Tensor!(T, _)) \
and (|T|(input: .Tensor!(T, _)) -> .Tensor!(T, _))
.min: (|T|(input: .Tensor!(T, _), dim: Nat, keepdim := Bool) -> (.Tensor!(T, _)), .Tensor!(T, _)) \