Skip to Content
DocumentationArray and Nodearray

array

View the code on GitHub

Structs

Struct: Array

Array is the primary data structure in the autograd engine. It serves as a wrapper around the Node struct, which encapsulates the array’s data, shape, gradients, and other metadata.

Fields

  • node: ArcPointer[Node]

Methods

__init__(out self, shape: List[Int], requires_grad: Bool = False, is_complex: Bool = False)
more details
Args
  • self: Self

  • shape: List[Int]

  • requires_grad: Bool (default: False)

  • is_complex: Bool (default: False)

__init__(out self, array_shape: ArrayShape, is_view: Bool = False)
more details
Args
  • self: Self

  • array_shape: ArrayShape

  • is_view: Bool (default: False)

__init__(out self, node: ArcPointer[Node])
more details
Args
  • self: Self

  • node: ArcPointer[Node]

__init__(out self, input_string: String, requires_grad: Bool = False)
more details
Args
  • self: Self

  • input_string: String

  • requires_grad: Bool (default: False)

__copyinit__(out self, other: Self)
more details
Args
  • self: Self

  • other: Self

__moveinit__(out self, owned other: Self)
more details
Args
  • self: Self

  • other: Self

__getitem__(self, *slices: Slice) -> Self
more details
Args
  • self: Self

  • *slices: Slice

Returns
  • Self
__setitem__(mut self, *slices: Slice, *, value: Variant[SIMD[float32, 1], Array])
more details
Args
  • self: Self

  • *slices: Slice

  • value: Variant[SIMD[float32, 1], Array]

__neg__(self) -> Self
more details
Args
  • self: Self
Returns
  • Self
__lt__(self, other: Self) -> Bool
more details
Args
  • self: Self

  • other: Self

Returns
  • Bool
__lt__(self, other: SIMD[float32, 1]) -> Bool
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Bool
__le__(self, other: Self) -> Bool
more details
Args
  • self: Self

  • other: Self

Returns
  • Bool
__le__(self, other: SIMD[float32, 1]) -> Bool
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Bool
__eq__(self, other: Self) -> Bool
more details
Args
  • self: Self

  • other: Self

Returns
  • Bool
__eq__(self, other: SIMD[float32, 1]) -> Bool
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Bool
__ne__(self, other: Self) -> Bool
more details
Args
  • self: Self

  • other: Self

Returns
  • Bool
__ne__(self, other: SIMD[float32, 1]) -> Bool
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Bool
__gt__(self, other: Self) -> Bool
more details
Args
  • self: Self

  • other: Self

Returns
  • Bool
__gt__(self, other: SIMD[float32, 1]) -> Bool
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Bool
__ge__(self, other: Self) -> Bool
more details
Args
  • self: Self

  • other: Self

Returns
  • Bool
__ge__(self, other: SIMD[float32, 1]) -> Bool
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Bool
__add__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__add__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__sub__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__sub__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__mul__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__mul__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__matmul__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__truediv__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__truediv__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__pow__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__pow__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__radd__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__radd__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__rsub__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__rsub__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__rmul__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__rmul__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__rmatmul__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__rtruediv__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__rtruediv__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__rpow__(self, other: Self) -> Self
more details
Args
  • self: Self

  • other: Self

Returns
  • Self
__rpow__(self, other: SIMD[float32, 1]) -> Self
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

Returns
  • Self
__iadd__(mut self, other: Self)
more details
Args
  • self: Self

  • other: Self

__iadd__(mut self, other: SIMD[float32, 1])
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

__isub__(mut self, other: Self)
more details
Args
  • self: Self

  • other: Self

__isub__(mut self, other: SIMD[float32, 1])
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

__imul__(mut self, other: Self)
more details
Args
  • self: Self

  • other: Self

__imul__(mut self, other: SIMD[float32, 1])
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

__itruediv__(mut self, other: Self)
more details
Args
  • self: Self

  • other: Self

__itruediv__(mut self, other: SIMD[float32, 1])
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

__ipow__(mut self, other: Self)
more details
Args
  • self: Self

  • other: Self

__ipow__(mut self, other: SIMD[float32, 1])
more details
Args
  • self: Self

  • other: SIMD[float32, 1]

id(self) -> Int
more details
Args
  • self: Self
Returns
  • Int
id_(mut self, id: Int)
more details
Args
  • self: Self

  • id: Int

array_shape(self) -> ArrayShape
more details
Args
  • self: Self
Returns
  • ArrayShape
array_shape_(mut self, shape: ArrayShape)
more details
Args
  • self: Self

  • shape: ArrayShape

is_computed(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
is_computed_(mut self, is_computed: Bool)
more details
Args
  • self: Self

  • is_computed: Bool

is_graph_node_computed(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
is_graph_node_computed_(mut self, is_computed: Bool)
more details
Args
  • self: Self

  • is_computed: Bool

postpone_as_grpah_output(mut self)
more details
Args
  • self: Self
args(self) -> List[Array]
more details
Args
  • self: Self
Returns
  • List[Array]
args_(mut self, args: List[Array])
more details
Args
  • self: Self

  • args: List[Array]

clear_args(mut self)
more details
Args
  • self: Self
remove_grad(mut self)
more details
Args
  • self: Self
kwargs(self) -> List[Array]
more details
Args
  • self: Self
Returns
  • List[Array]
kwargs_(mut self, kwargs: List[Array])
more details
Args
  • self: Self

  • kwargs: List[Array]

id_in_graph_(mut self, id_in_graph: Int)
more details
Args
  • self: Self

  • id_in_graph: Int

id_in_graph(self) -> Int
more details
Args
  • self: Self
Returns
  • Int
graph(self) -> ArcPointer[FxGraph]
more details
Args
  • self: Self
Returns
  • ArcPointer[FxGraph]
data_(mut self, owned data_ptr: UnsafePointer[SIMD[float32, 1]])
more details
Args
  • self: Self

  • data_ptr: UnsafePointer[SIMD[float32, 1]]

graph_(mut self, graph: ArcPointer[FxGraph])
more details
Args
  • self: Self

  • graph: ArcPointer[FxGraph]

has_fxgraph(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
is_breakpoint(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
is_breakpoint_(mut self, is_breakpoint: Bool)
more details
Args
  • self: Self

  • is_breakpoint: Bool

item(self, idx: Int) -> Self
more details
Args
  • self: Self

  • idx: Int

Returns
  • Self
setup_array_shape(mut self, array_shape: ArrayShape)
more details
Args
  • self: Self

  • array_shape: ArrayShape

uew(self) -> List[fn(SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]) -> Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]]]
more details
Args
  • self: Self
Returns
  • List[fn(SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]) -> Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]]]
bew(self) -> List[fn(SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]) -> Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]]]
more details
Args
  • self: Self
Returns
  • List[fn(SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]) -> Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]]]
inplace_infos(self) -> List[InplaceInfo]
more details
Args
  • self: Self
Returns
  • List[InplaceInfo]
append_arg(mut self, arg: Self)
more details
Args
  • self: Self

  • arg: Self

append_inplace_info(mut self, inplace_info: InplaceInfo)
more details
Args
  • self: Self

  • inplace_info: InplaceInfo

append_uew(mut self, uew: fn(SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]) -> Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]])
more details
Args
  • self: Self

  • uew: fn(SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]) -> Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]]

append_bew(mut self, bew: fn(SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]) -> Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]])
more details
Args
  • self: Self

  • bew: fn(SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]) -> Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]]

shape(self) -> List[Int]
more details
Args
  • self: Self
Returns
  • List[Int]
shape_(mut self, shape: List[Int])
more details
Args
  • self: Self

  • shape: List[Int]

stride_(mut self, stride: List[Int])
more details
Args
  • self: Self

  • stride: List[Int]

stride(self) -> List[Int]
more details
Args
  • self: Self
Returns
  • List[Int]
storage_offset(self) -> Int
more details
Args
  • self: Self
Returns
  • Int
storage_offset_(mut self, storage_offset: Int)
more details
Args
  • self: Self

  • storage_offset: Int

ndim(self) -> Int
more details
Args
  • self: Self
Returns
  • Int
size(self) -> Int
more details
Args
  • self: Self
Returns
  • Int
is_view(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
is_view_(mut self, is_view: Bool)
more details
Args
  • self: Self

  • is_view: Bool

base_(mut self, base: Self)
more details
Args
  • self: Self

  • base: Self

base(self) -> Self
more details
Args
  • self: Self
Returns
  • Self
requires_grad(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
requires_grad_(mut self, requires_grad: Bool)
more details
Args
  • self: Self

  • requires_grad: Bool

meta_data(self) -> List[Int]
more details
Args
  • self: Self
Returns
  • List[Int]
meta_data_(mut self, meta_data: List[Int])
more details
Args
  • self: Self

  • meta_data: List[Int]

has_real(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
has_real_(mut self, has_real: Bool)
more details
Args
  • self: Self

  • has_real: Bool

has_imag(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
has_imag_(mut self, has_imag: Bool)
more details
Args
  • self: Self

  • has_imag: Bool

is_complex(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
is_complex_(mut self, is_complex: Bool)
more details
Args
  • self: Self

  • is_complex: Bool

data(self) -> UnsafePointer[SIMD[float32, 1]]
more details
Args
  • self: Self
Returns
  • UnsafePointer[SIMD[float32, 1]]
real_idx(self, idx: Int) -> Int
more details
Args
  • self: Self

  • idx: Int

Returns
  • Int
imag_idx(self, idx: Int) -> Int
more details
Args
  • self: Self

  • idx: Int

Returns
  • Int
load[width: Int = 1](self, idx: Int) -> SIMD[float32, width]
more details
Args
  • self: Self

  • idx: Int

Returns
  • SIMD[float32, width]
store[width: Int = 1](mut self, idx: Int, data: SIMD[float32, width])
more details
Args
  • self: Self

  • idx: Int

  • data: SIMD[float32, width]

load_imag[width: Int = 1](self, idx: Int) -> SIMD[float32, width]
more details
Args
  • self: Self

  • idx: Int

Returns
  • SIMD[float32, width]
store_imag[width: Int = 1](mut self, idx: Int, data: SIMD[float32, width])
more details
Args
  • self: Self

  • idx: Int

  • data: SIMD[float32, width]

load_complex[width: Int = 1](self, idx: Int) -> Tuple[SIMD[float32, 2.__mul__(width).__floordiv__(2)], SIMD[float32, 2.__mul__(width).__floordiv__(2)]]
more details
Args
  • self: Self

  • idx: Int

Returns
  • Tuple[SIMD[float32, 2.__mul__(width).__floordiv__(2)], SIMD[float32, 2.__mul__(width).__floordiv__(2)]]
store_complex[width: Int = 1](mut self, idx: Int, real: SIMD[float32, width], imag: SIMD[float32, width])
more details
Args
  • self: Self

  • idx: Int

  • real: SIMD[float32, width]

  • imag: SIMD[float32, width]

compute_jvp(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
set_compute_jvp(mut self, compute_jvp: Bool)
more details
Args
  • self: Self

  • compute_jvp: Bool

set_fwd(mut self, fwd: fn(mut Array, List[Array]) raises -> None)
more details
Args
  • self: Self

  • fwd: fn(mut Array, List[Array]) raises -> None

fwd(self) -> fn(mut Array, List[Array]) raises -> None
more details
Args
  • self: Self
Returns
  • fn(mut Array, List[Array]) raises -> None
jvp_(mut self, jvp: fn(List[Array], List[Array]) raises -> Array)
more details
Args
  • self: Self

  • jvp: fn(List[Array], List[Array]) raises -> Array

jvp(self) -> fn(List[Array], List[Array]) raises -> Array
more details
Args
  • self: Self
Returns
  • fn(List[Array], List[Array]) raises -> Array
vjp_(mut self, vjp: fn(List[Array], Array, Array) raises -> List[Array])
more details
Args
  • self: Self

  • vjp: fn(List[Array], Array, Array) raises -> List[Array]

vjp(self) -> fn(List[Array], Array, Array) raises -> List[Array]
more details
Args
  • self: Self
Returns
  • fn(List[Array], Array, Array) raises -> List[Array]
has_grad(self) -> Bool
more details
Args
  • self: Self
Returns
  • Bool
grad_(mut self, grad: Self)
more details
Args
  • self: Self

  • grad: Self

grad(self) -> Self
more details
Args
  • self: Self
Returns
  • Self
set_name(mut self, name: String)
more details
Args
  • self: Self

  • name: String

name(self) -> String
more details
Args
  • self: Self
Returns
  • String
execute_fwd(mut self)
more details
Args
  • self: Self
__str__(self) -> String
more details
Args
  • self: Self
Returns
  • String
write_to[W: Writer](self, mut writer: W)
more details
Args
  • self: Self

  • writer: W

execute_fwds(mut self)
more details
Args
  • self: Self
graph_dual(self) -> Self
more details
Args
  • self: Self
Returns
  • Self
backward(self, create_graph: Bool = False)
more details
Args
  • self: Self

  • create_graph: Bool (default: False)

zero_grad(mut self)
more details
Args
  • self: Self
T(self) -> Self
more details
Args
  • self: Self
Returns
  • Self
reshape(self, shape: List[Int]) -> Self
more details
Args
  • self: Self

  • shape: List[Int]

Returns
  • Self

Functions

default_fwd

default_fwd(mut curr: Array, args: List[Array])
more details
Args
  • curr: Array

  • args: List[Array]

default_vjp

default_vjp(primals: List[Array], grad: Array, out: Array) -> List[Array]
more details
Args
  • primals: List[Array]

  • grad: Array

  • out: Array

Returns
  • List[Array]

default_jvp

default_jvp(primals: List[Array], tangents: List[Array]) -> Array
more details
Args
  • primals: List[Array]

  • tangents: List[Array]

Returns
  • Array
Last updated on