Shape

object Shape
Companion
class
class Object
trait Matchable
class Any

Type members

Types

type Concat[X <: Shape, Y <: Shape] = X match { case SNil => Y case head #: tail => head #: Concat[tail, Y] }
type FoldLeft[B, X <: Shape, Z <: B, F <: ([_ <: B, _ <: Int] =>> B)] = X match { case SNil => Z case head #: tail => FoldLeft[B, tail, F[Z, head], F] }

Apply a folding function to the elements of a Shape Type-level representation of def foldLeft[B](z: B)(op: (B, A) => B): B

Apply a folding function to the elements of a Shape Type-level representation of def foldLeft[B](z: B)(op: (B, A) => B): B

Type Params
B

Return type of the operation

F

Function taking an accumulator of type B, and an element of type Int, returning B

X

Shape to fold over

Z

Zero element

type Head[X <: Shape] = X match { case head #: _ => head }
type IsEmpty[X <: Shape] = X match { case SNil => true case _ #: _ => false }
type Map[X <: Shape, F <: ([_ <: Dimension] =>> Dimension)] = X match { case SNil => SNil case head #: tail => F[head] #: Map[tail, F] }

Apply a function to elements of a Shape. Type-level representation of def map(f: (A) => A): List[A]

Apply a function to elements of a Shape. Type-level representation of def map(f: (A) => A): List[A]

Type Params
F

Function taking an value of the Shape, returning another value

X

Shape to map over

type NumElements[X <: Shape] = X match { case SNil => 1 case head #: tail => head * NumElements[tail] }
type Rank[X <: Shape] = X match { case SNil => 0 case head #: tail => Rank[tail] + 1 }
type Reduce[S <: Shape, Axes <: None | Indices] = Axes match { case None => SNil case Indices => ReduceLoop[S, Axes, 0] }

Represents reduction along axes, as defined in TensorFlow:

Represents reduction along axes, as defined in TensorFlow:

  • None means reduce along all axes
  • List of indices contain which indices in the shape to remove
  • Empty list of indices means reduce along nothing
Type Params
Axes

List of indices to reduce along. one if reduction should be done along all axes. SNil if no reduction should be done.

S

Shape to reduce

type RemoveIndex[RemoveFrom <: Shape, I <: Index] = 0 <= I && I < Rank[RemoveFrom] match { case true => RemoveIndexLoop[RemoveFrom, I, 0] }

Remove the element at index I in RemoveFrom.

Remove the element at index I in RemoveFrom.

Type Params
I

Index to remove

RemoveFrom

Shape to remove from

type Reverse[X <: Shape] = X match { case SNil => SNil case head #: tail => Concat[Reverse[tail], head #: SNil] }
type Tail[X <: Shape] = X match { case _ #: tail => tail }
type WithinBounds[I <: Index, S <: Shape] = 0 <= I && I < Rank[S]

Returns whether index I is within bounds of S

Returns whether index I is within bounds of S

Value members

Concrete methods

def concat[X <: Shape, Y <: Shape](x: X, y: Y): Concat[X, Y]
def fromSeq(seq: Seq[Int]): Shape
def matrix(rows: Dimension, columns: Dimension): rows #: columns #: SNil
def numElements[X <: Shape](x: X): NumElements[X]
def rank[X <: Shape](x: X): Rank[X]
def reverse[X <: Shape](x: X): Reverse[X]
def scalar: SNil
def vector(length: Dimension): length #: SNil