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


holor_index

holor_index ds is the type of valid index tuples to identify an entry of a holor of dimensions ds

holor

Holor (indexed collections of tensor coefficients)

holor.mul

The tensor product of two holors.

holor.slice

A slice is a subholor consisting of all entries with initial index i.

holor.unit_vec

The 1-dimensional "unit" holor with 1 in the jth position.

holor.slice_eq

Two holors are equal if all their slices are equal.

holor.sum_unit_vec_mul_slice

The original holor can be recovered from its slices by multiplying with unit vectors and summing up.

holor.cprank_max1

cprank_max1 x means x has CP rank at most 1, that is, it is the tensor product of 1-dimensional holors.

holor.cprank_max

cprank_max 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.

holor.cprank

The CP rank of a holor x: the smallest N such that x can be written as the sum of N holors of rank at most 1.