Basic properties of holors #
Holors are indexed collections of tensor coefficients. Confusingly, they are often called tensors in physics and in the neural network community.
A holor is simply a multidimensional array of values. The size of a
holor is specified by a List ℕ
, whose length is called the dimension
of the holor.
The tensor product of x₁ : Holor α ds₁
and x₂ : Holor α ds₂
is the
holor given by (x₁ ⊗ x₂) (i₁ ++ i₂) = x₁ i₁ * x₂ i₂
. A holor is "of
rank at most 1" if it is a tensor product of one-dimensional holors.
The CP rank of a holor x
is the smallest N such that x
is the sum
of N holors of rank at most 1.
Based on the tensor library found in https://www.isa-afp.org/entries/Deep_Learning.html
References #
HolorIndex ds
is the type of valid index tuples used to identify an entry of a holor
of dimensions ds
.
Instances For
Instances For
Instances For
Equations
Instances For
Equations
Instances For
Equations
- Holor.instInhabited = { default := fun (x : HolorIndex ds) => default }
Equations
- Holor.instZero = { zero := fun (x : HolorIndex ds) => 0 }
Equations
- Holor.instAdd = { add := fun (x y : Holor α ds) (t : HolorIndex ds) => x t + y t }
Equations
- Holor.instNeg = { neg := fun (a : Holor α ds) (t : HolorIndex ds) => -a t }
Equations
Equations
Equations
Equations
Equations
Equations
- Holor.instSMulOfMul = { smul := fun (a : α) (x : Holor α ds) (t : HolorIndex ds) => a * x t }
Equations
- Holor.instModule = Pi.module (HolorIndex ds) (fun (a : HolorIndex ds) => α) α
CPRankMax1 x
means x
has CP rank at most 1, that is,
it is the tensor product of 1-dimensional holors.
- nil {α : Type} [Mul α] (x : Holor α []) : x.CPRankMax1
- cons {α : Type} [Mul α] {d : ℕ} {ds : List ℕ} (x : Holor α [d]) (y : Holor α ds) : y.CPRankMax1 → (x.mul y).CPRankMax1
Instances For
CPRankMax N x
means x
has CP rank at most N
, that is,
it can be written as the sum of N holors of rank at most 1.
- zero {α : Type} [Mul α] [AddMonoid α] {ds : List ℕ} : CPRankMax 0 0
- succ {α : Type} [Mul α] [AddMonoid α] (n : ℕ) {ds : List ℕ} (x y : Holor α ds) : x.CPRankMax1 → CPRankMax n y → CPRankMax (n + 1) (x + y)