Idris2Doc : Data.Tensor.Utils

Data.Tensor.Utils

(source)

Definitions

Scalar : Type -> Type
Totality: total
Visibility: public export
Vector : Axis -> Type -> Type
Totality: total
Visibility: public export
Matrix : (row : Axis) -> (col : Axis) -> ConsistentWith row [col] => Type -> Type
Totality: total
Visibility: public export
fillAt : (tensorCont shape) .Shp -> a -> Tensor shape a
  Fills a tensor of a given shape with value `x`
Simple an alias for `tensorReplicateAt`

Totality: total
Visibility: public export
fill : AllC TensorMonoid shape => a -> Tensor shape a
Totality: total
Visibility: public export
zerosAt : Num a => (tensorCont shape) .Shp -> Tensor shape a
Totality: total
Visibility: public export
zeros : Num a => AllC TensorMonoid shape => Tensor shape a
Totality: total
Visibility: public export
onesAt : Num a => (tensorCont shape) .Shp -> Tensor shape a
Totality: total
Visibility: public export
ones : Num a => AllC TensorMonoid shape => Tensor shape a
Totality: total
Visibility: public export
identityBool : IsCubical c => Tensor [c, c] Bool
  An identity matrix with True on the diagonal and False elsewhere

Totality: total
Visibility: public export
identity : IsCubical c => Num a => Tensor [c, c] a
  An identity matrix with ones on the diagonal and zeros elsewhere
Analogous to numpy.eye

Totality: total
Visibility: public export
arange : IsCubical stop => Cast Nat a => Tensor [stop] a
  A range of numbers [0, stop>

Totality: total
Visibility: public export
arangeFromTo : {default (TTInternalName ~~> 0) start : Axis} -> {auto cStart : IsCubical start} -> {auto cStop : IsCubical stop} -> Cast Nat a => Tensor [(stop .name ~~> minus (stop .dim) (start .dim))] a
  A range of numbers [start, stop>

Totality: total
Visibility: public export
flip : (axis : Fin rank) -> IsCubical (index axis (toVect shape)) => Tensor shape a -> Tensor shape a
  Reverse a tensor along a given axis
concat : {auto {conArg:10203} : IsCubical x} -> {auto {conArg:10206} : IsCubical y} -> {auto {conArg:10209} : ConsistentWith (l ~~> (x .dim + y .dim)) shape} -> {auto {conArg:10217} : ConsistentWith x shape} -> {auto {conArg:10221} : ConsistentWith y shape} -> Tensor (x :: shape) a -> Tensor (y :: shape) a -> Tensor ((l ~~> (x .dim + y .dim)) :: shape) a
  Concatenate two tensors along an existing axis, the first one
TODO extend to allow concatenation along an arbitrary/named axis

Totality: total
Visibility: public export
size : Tensor shape a -> Nat
  Number of elements in a non-cubical tensor
size : All IsCubical (toVect shape) => (0 _ : Tensor shape a) -> Nat
  Number of elements in a cubical tensor

Totality: total
Visibility: public export
flatten : Foldable (Tensor shape) => Tensor shape a -> List a
  Flatten a non-cubical tensor into a list
Requires that we have Foldable on all the components
In general we won't know the number of elements of a non-cubical tensor at compile time

Totality: total
Visibility: public export
max : Foldable (Tensor shape) => Ord a => Tensor shape a -> Maybe a
  Maximum value in a tensor
Returns Nothing if the tensor is empty

Totality: total
Visibility: public export
argmax : Ord a => IsFoldable (i .cont) => IsNonEmpty (i .cont) => (t : Tensor [i] a) -> (i .cont) .Pos (t .extractShapeRank1)
Totality: total
Visibility: public export
argmin : Ord a => IsFoldable (i .cont) => IsNonEmpty (i .cont) => (t : Tensor [i] a) -> (i .cont) .Pos (t .extractShapeRank1)
  At the moment this simply reuses the vect implementation
To be revised at some point later

Totality: total
Visibility: public export
isClose : {default 1e-8 _ : Double} -> {default 1e-5 _ : Double} -> Double -> Double -> Bool
  Scalar approximate equality, following NumPy's `isclose`:
|x - y| <= atol + rtol * |y|

Totality: total
Visibility: public export
allClose : Applicative (Tensor shape) => Foldable (Tensor shape) => {default 1e-8 _ : Double} -> {default 1e-5 _ : Double} -> Tensor shape Double -> Tensor shape Double -> Bool
  Elementwise approximate equality of tensors, following NumPy's `allclose`

Totality: total
Visibility: public export
oneHot : {auto {conArg:10684} : IsCubical c} -> Fin (c .dim) -> Num a => Tensor [c] a
Totality: total
Visibility: public export
cTriBool : InterfaceOnPositions (c .cont) MOrd => TensorMonoid (c .cont) => (c .cont) .Shp -> Tensor [c, c] Bool
Totality: total
Visibility: public export
triBool : IsCubical c => Tensor [c, c] Bool
Totality: total
Visibility: public export
tri : IsCubical c => Num a => Tensor [c, c] a
  A matrix with ones on and below the diagonal, and zeros elsewhere
Analogous to numpy.tri

Totality: total
Visibility: public export
lowerTriangular : IsCubical c => Num a => Tensor [c, c] a -> Tensor [c, c] a
  Lower triangular part of a matrix. Elements above the diagonal are set to
zero. Analogous to numpy.tril

Totality: total
Visibility: public export
upperTriangular : IsCubical c => Num a => Tensor [c, c] a -> Tensor [c, c] a
  Upper triangular part of a matrix. Elements below the diagonal are set to
zero. Analogous to numpy.triu(.., k=1)

Totality: total
Visibility: public export
maskedFill : Num a => AllC TensorMonoid shape => Tensor shape a -> Tensor shape Bool -> a -> Tensor shape a
  Fill the elements of a tensor `t` with `fill` where `mask` is True

Totality: total
Visibility: public export
sum : Algebra (Tensor shape) a => Tensor shape a -> a
Totality: total
Visibility: public export
mean : All IsCubical (toVect shape) => Cast Nat a => Fractional a => Algebra (Tensor shape) a => Tensor shape a -> a
Totality: total
Visibility: public export
variance : IsCubical c => Neg a => Fractional a => Cast Nat a => Tensor [c] a -> a
Totality: total
Visibility: public export
cumulativeSum : Num a => Traversable (Ext (c .cont)) => Tensor [c] a -> Tensor [c] a
Totality: total
Visibility: public export
tensorComMonoid : AllC TensorMonoid shape => ComMonoid a -> ComMonoid (Tensor shape a)
  Pointwise commutative monoid structure on tensors, lifted from the one
on the underlying type

Totality: total
Visibility: public export
inorder : Tensor [(b ~> BinTreeNode)] a -> Tensor [(l ~> List)] a
Totality: total
Visibility: public export
random : Num a => Random a => HasIO io => (shape : TensorShape rank) -> All IsCubical (toVect shape) => Applicative (Tensor shape) => Traversable (Tensor shape) => io (Tensor shape a)
Totality: total
Visibility: public export