argamak/axis

Types

An Axis list.

pub type Axes =
  List(Axis)

The elements that comprise a Space.

Except for Infer, every Axis has a size corresponding to the number of values that fit along that Axis when a Tensor is put into a Space containing that Axis.

An Axis can be given a unique name using the Axis or Infer constructors. Single-letter constructors are also provided for convenience.

The special Infer constructor can be used once per Space. It will be replaced and have its size computed when a Tensor is put into that Space.

pub type Axis {
  Axis(name: String, size: Int)
  Infer(name: String)
  A(size: Int)
  B(size: Int)
  C(size: Int)
  D(size: Int)
  E(size: Int)
  F(size: Int)
  G(size: Int)
  H(size: Int)
  I(size: Int)
  J(size: Int)
  K(size: Int)
  L(size: Int)
  M(size: Int)
  N(size: Int)
  O(size: Int)
  P(size: Int)
  Q(size: Int)
  R(size: Int)
  S(size: Int)
  T(size: Int)
  U(size: Int)
  V(size: Int)
  W(size: Int)
  X(size: Int)
  Y(size: Int)
  Z(size: Int)
}

Constructors

  • Axis(name: String, size: Int)
  • Infer(name: String)
  • A(size: Int)
  • B(size: Int)
  • C(size: Int)
  • D(size: Int)
  • E(size: Int)
  • F(size: Int)
  • G(size: Int)
  • H(size: Int)
  • I(size: Int)
  • J(size: Int)
  • K(size: Int)
  • L(size: Int)
  • M(size: Int)
  • N(size: Int)
  • O(size: Int)
  • P(size: Int)
  • Q(size: Int)
  • R(size: Int)
  • S(size: Int)
  • T(size: Int)
  • U(size: Int)
  • V(size: Int)
  • W(size: Int)
  • X(size: Int)
  • Y(size: Int)
  • Z(size: Int)

Functions

pub fn name(x: Axis) -> String

Returns the name of a given Axis.

Examples

> name(A(1))
"A"

> name(Axis(name: "Sparkle", size: 99))
"Sparkle"

> name(Infer("Silver"))
"Silver"
pub fn rename(x: Axis, name: String) -> Axis

Renames the given Axis, retaining its size.

If an Axis is renamed to a single capital letter (from "A" to "Z" inclusive), the single-letter convenience constructor will be used for the new Axis.

Examples

> let x = A(1)
> rename(x, "B")
B(1)

> let x = Axis("Thing", 3)
> rename(x, "Y")
Y(3)

> let x = Axis(name: "Sparkle", size: 99)
> rename(x, "Shine")
Axis("Shine", 99)

> let x = Infer("Silver")
> rename(x, "Gold")
Infer("Gold")
pub fn resize(x: Axis, size: Int) -> Axis

Changes the size of the given Axis.

Resizing an Infer returns an Axis record that will no longer have its size automatically computed.

Examples

> let x = A(1)
> resize(x, 3)
A(3)

> let x = Axis("Y", 2)
> resize(x, 3)
Y(3)

> let x = Axis(name: "Sparkle", size: 99)
> resize(x, 42)
Axis("Sparkle", 42)

> let x = Infer("A")
> resize(x, 1)
A(1)
pub fn size(x: Axis) -> Int

Returns the size of a given Axis.

The size of Infer is always 0.

Examples

> size(A(1))
1

> size(Axis(name: "Sparkle", size: 99))
99

> size(Infer("Silver"))
0
Search Document