mlx.core.array

mlx.core.array#

class array#

An N-dimensional array object.

__init__(self: array, val: scalar | list | tuple | ndarray | array, dtype: Dtype | None = None)#

Methods

__init__(self, val[, dtype])

abs(self, *[, stream])

See abs().

all(self[, axis, keepdims, stream])

See all().

any(self[, axis, keepdims, stream])

See any().

argmax(self[, axis, keepdims, stream])

See argmax().

argmin(self[, axis, keepdims, stream])

See argmin().

astype(self, dtype[, stream])

Cast the array to a specified type.

conj(self, *[, stream])

See conj().

cos(self, *[, stream])

See cos().

cummax(self[, axis, reverse, inclusive, stream])

See cummax().

cummin(self[, axis, reverse, inclusive, stream])

See cummin().

cumprod(self[, axis, reverse, inclusive, stream])

See cumprod().

cumsum(self[, axis, reverse, inclusive, stream])

See cumsum().

diag(self[, k, stream])

Extract a diagonal or construct a diagonal matrix.

diagonal(self[, offset, axis1, axis2, stream])

See diagonal().

exp(self, *[, stream])

See exp().

flatten(self[, start_axis, end_axis, stream])

See flatten().

item(self)

Access the value of a scalar array.

log(self, *[, stream])

See log().

log10(self, *[, stream])

See log10().

log1p(self, *[, stream])

See log1p().

log2(self, *[, stream])

See log2().

logcumsumexp(self[, axis, reverse, ...])

See logcumsumexp().

logsumexp(self[, axis, keepdims, stream])

See logsumexp().

max(self[, axis, keepdims, stream])

See max().

mean(self[, axis, keepdims, stream])

See mean().

min(self[, axis, keepdims, stream])

See min().

moveaxis(self, source, destination, *[, stream])

See moveaxis().

prod(self[, axis, keepdims, stream])

See prod().

reciprocal(self, *[, stream])

See reciprocal().

reshape(self, *shape[, stream])

Equivalent to reshape() but the shape can be passed either as a tuple or as separate arguments.

round(self[, decimals, stream])

See round().

rsqrt(self, *[, stream])

See rsqrt().

sin(self, *[, stream])

See sin().

split(self, indices_or_sections[, axis, stream])

See split().

sqrt(self, *[, stream])

See sqrt().

square(self, *[, stream])

See square().

squeeze(self[, axis, stream])

See squeeze().

std(self[, axis, keepdims, ddof, stream])

See std().

sum(self[, axis, keepdims, stream])

See sum().

swapaxes(self, axis1, axis2, *[, stream])

See swapaxes().

tolist(self)

Convert the array to a Python list.

transpose(self, *axes[, stream])

Equivalent to transpose() but the axes can be passed either as a tuple or as separate arguments.

var(self[, axis, keepdims, ddof, stream])

See var().

view(self, dtype, *[, stream])

See view().

Attributes

T

Equivalent to calling self.transpose() with no arguments.

at

Used to apply updates at the given indices.

dtype

The array's Dtype.

imag

The imaginary part of a complex array.

itemsize

The size of the array's datatype in bytes.

nbytes

The number of bytes in the array.

ndim

The array's dimension.

real

The real part of a complex array.

shape

The shape of the array as a Python tuple.

size

Number of elements in the array.