File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -344,10 +344,6 @@ export
344
344
(. T ) : Tensor [m, n] dtype -> Tensor [n, m] dtype
345
345
(MkTensor expr). T = MkTensor $ Transpose [1 , 0 ] expr
346
346
347
- public export
348
- index' : (xs : List Nat ) -> (n : Nat ) -> {auto 0 ok : InBounds n xs} -> Nat
349
- index' xs n = index n xs
350
-
351
347
||| Transpose axes of a tensor. This is a more general version of `(.T)`, in which you can transpose
352
348
||| any number of axes in a tensor of arbitrary rank. The i'th axis in the resulting tensor
353
349
||| corresponds to the `index i ordering`'th axis in the input tensor. For example, for
@@ -399,7 +395,7 @@ transpose :
399
395
{auto 0 lengths : length ordering = length shape} ->
400
396
{auto 0 unique : Sorted Neq ordering} ->
401
397
{auto 0 inBounds : All (flip InBounds shape) ordering} ->
402
- Tensor (map (index' shape) ordering) dtype
398
+ Tensor (map (dflip List . index shape) ordering) dtype
403
399
transpose ordering (MkTensor expr) = MkTensor $ Transpose ordering expr
404
400
405
401
||| The identity tensor, with inferred shape and element type. For example,
Original file line number Diff line number Diff line change @@ -21,8 +21,14 @@ import public Data.List.Quantifiers
21
21
import public Data . Nat
22
22
import public Data . Vect
23
23
24
- ||| A `Neq x y` proves `x` is not equal to `y`.
24
+ ||| A dependent variant of `flip` where the return type can depend on the input values. `dflip`
25
+ ||| flips the order of arguments for a function, such that `dflip f x y` is the same as `f y x`.
25
26
public export
27
+ dflip : {0 c : a -> b -> Type } -> ((x : a) -> (y : b) -> c x y) -> (y : b) -> (x : a) -> c x y
28
+ dflip f y x = f x y
29
+
30
+ ||| A `Neq x y` proves `x` is not equal to `y`.
31
+ public export 0
26
32
Neq : Nat -> Nat -> Type
27
33
Neq x y = Either (LT x y) (GT x y)
28
34
You can’t perform that action at this time.
0 commit comments