mlx_nif (mlx v0.2.0)

View Source

Summary

Functions

Types

array/0

-type array() :: reference().

device/0

-type device() :: cpu | gpu.

dtype/0

-type dtype() :: atom().

shape/0

-type shape() :: [integer()].

Functions

abs(A)

-spec abs(array()) -> {ok, array()} | {error, term()}.

add(A, B)

-spec add(array(), array()) -> {ok, array()} | {error, term()}.

all(A, Axis, Keepdims)

-spec all(array(), list(), boolean()) -> {ok, array()} | {error, term()}.

allclose(A, B, Tolerance)

-spec allclose(array(), array(), float()) -> {ok, boolean()} | {error, term()}.

any(A, Axis, Keepdims)

-spec any(array(), list(), boolean()) -> {ok, array()} | {error, term()}.

arange(Start, Stop, Step)

-spec arange(number(), number(), number()) -> {ok, array()} | {error, term()}.

arccos(A)

-spec arccos(array()) -> {ok, array()} | {error, term()}.

arccosh(A)

-spec arccosh(array()) -> {ok, array()} | {error, term()}.

arcsin(A)

-spec arcsin(array()) -> {ok, array()} | {error, term()}.

arcsinh(A)

-spec arcsinh(array()) -> {ok, array()} | {error, term()}.

arctan2(A, B)

-spec arctan2(array(), array()) -> {ok, array()} | {error, term()}.

arctan(A)

-spec arctan(array()) -> {ok, array()} | {error, term()}.

arctanh(A)

-spec arctanh(array()) -> {ok, array()} | {error, term()}.

argsort(A)

-spec argsort(array()) -> {ok, array()} | {error, term()}.

argsort(A, Axis)

-spec argsort(array(), integer()) -> {ok, array()} | {error, term()}.

array(Data, Dtype)

-spec array(term(), dtype()) -> {ok, array()} | {error, term()}.

array_equal(A, B)

-spec array_equal(array(), array()) -> {ok, boolean()} | {error, term()}.

bitwise_and(A, B)

-spec bitwise_and(array(), array()) -> {ok, array()} | {error, term()}.

bitwise_invert(A)

-spec bitwise_invert(array()) -> {ok, array()} | {error, term()}.

bitwise_or(A, B)

-spec bitwise_or(array(), array()) -> {ok, array()} | {error, term()}.

bitwise_xor(A, B)

-spec bitwise_xor(array(), array()) -> {ok, array()} | {error, term()}.

broadcast_arrays(Arrays)

-spec broadcast_arrays(list()) -> {ok, list()} | {error, term()}.

broadcast_to(A, Shape)

-spec broadcast_to(array(), shape()) -> {ok, array()} | {error, term()}.

ceil(A)

-spec ceil(array()) -> {ok, array()} | {error, term()}.

clip(A, Min, Max)

-spec clip(array(), number(), number()) -> {ok, array()} | {error, term()}.

concatenate(Arrays, Axis)

-spec concatenate(list(), integer()) -> {ok, array()} | {error, term()}.

conv1d(Input, Weight, Stride)

-spec conv1d(array(), array(), integer()) -> {ok, array()} | {error, term()}.

conv2d(Input, Weight, Stride)

-spec conv2d(array(), array(), list()) -> {ok, array()} | {error, term()}.

cos(A)

-spec cos(array()) -> {ok, array()} | {error, term()}.

cosh(A)

-spec cosh(array()) -> {ok, array()} | {error, term()}.

cummax(A, Axis)

-spec cummax(array(), integer()) -> {ok, array()} | {error, term()}.

cummin(A, Axis)

-spec cummin(array(), integer()) -> {ok, array()} | {error, term()}.

cumprod(A, Axis)

-spec cumprod(array(), integer()) -> {ok, array()} | {error, term()}.

cumsum(A, Axis)

-spec cumsum(array(), integer()) -> {ok, array()} | {error, term()}.

digamma(A)

-spec digamma(array()) -> {ok, array()} | {error, term()}.

divide(A, B)

-spec divide(array(), array()) -> {ok, array()} | {error, term()}.

divmod(A, B)

-spec divmod(array(), array()) -> {ok, {array(), array()}} | {error, term()}.

dot(A, B)

-spec dot(array(), array()) -> {ok, array()} | {error, term()}.

dtype_str(Array)

-spec dtype_str(array()) -> {ok, string()} | {error, term()}.

equal(A, B)

-spec equal(array(), array()) -> {ok, array()} | {error, term()}.

erf(A)

-spec erf(array()) -> {ok, array()} | {error, term()}.

erfc(A)

-spec erfc(array()) -> {ok, array()} | {error, term()}.

eval(Array)

-spec eval(array()) -> {ok, array()} | {error, term()}.

exp(A)

-spec exp(array()) -> {ok, array()} | {error, term()}.

expand_dims(A, Axis)

-spec expand_dims(array(), integer()) -> {ok, array()} | {error, term()}.

expm1(A)

-spec expm1(array()) -> {ok, array()} | {error, term()}.

eye(N, Dtype)

-spec eye(integer(), dtype()) -> {ok, array()} | {error, term()}.

floor(A)

-spec floor(array()) -> {ok, array()} | {error, term()}.

floor_divide(A, B)

-spec floor_divide(array(), array()) -> {ok, array()} | {error, term()}.

full(Shape, Value, Dtype)

-spec full(shape(), number(), dtype()) -> {ok, array()} | {error, term()}.

gamma(A)

-spec gamma(array()) -> {ok, array()} | {error, term()}.

greater(A, B)

-spec greater(array(), array()) -> {ok, array()} | {error, term()}.

greater_equal(A, B)

-spec greater_equal(array(), array()) -> {ok, array()} | {error, term()}.

inner(A, B)

-spec inner(array(), array()) -> {ok, array()} | {error, term()}.

isfinite(A)

-spec isfinite(array()) -> {ok, array()} | {error, term()}.

isinf(A)

-spec isinf(array()) -> {ok, array()} | {error, term()}.

isnan(A)

-spec isnan(array()) -> {ok, array()} | {error, term()}.

left_shift(A, B)

-spec left_shift(array(), array()) -> {ok, array()} | {error, term()}.

less(A, B)

-spec less(array(), array()) -> {ok, array()} | {error, term()}.

less_equal(A, B)

-spec less_equal(array(), array()) -> {ok, array()} | {error, term()}.

lgamma(A)

-spec lgamma(array()) -> {ok, array()} | {error, term()}.

linspace(Start, Stop, Num)

-spec linspace(number(), number(), integer()) -> {ok, array()} | {error, term()}.

log1p(A)

-spec log1p(array()) -> {ok, array()} | {error, term()}.

log2(A)

-spec log2(array()) -> {ok, array()} | {error, term()}.

log10(A)

-spec log10(array()) -> {ok, array()} | {error, term()}.

log(A)

-spec log(array()) -> {ok, array()} | {error, term()}.

logaddexp(A, B)

-spec logaddexp(array(), array()) -> {ok, array()} | {error, term()}.

loggamma(A)

-spec loggamma(array()) -> {ok, array()} | {error, term()}.

logical_and(A, B)

-spec logical_and(array(), array()) -> {ok, array()} | {error, term()}.

logical_not(A)

-spec logical_not(array()) -> {ok, array()} | {error, term()}.

logical_or(A, B)

-spec logical_or(array(), array()) -> {ok, array()} | {error, term()}.

matmul(A, B)

-spec matmul(array(), array()) -> {ok, array()} | {error, term()}.

max(A)

-spec max(array()) -> {ok, array()} | {error, term()}.

max(A, Axis)

-spec max(array(), list()) -> {ok, array()} | {error, term()}.

max(A, Axis, Keepdims)

-spec max(array(), list(), boolean()) -> {ok, array()} | {error, term()}.

maximum(A, B)

-spec maximum(array(), array()) -> {ok, array()} | {error, term()}.

mean(A)

-spec mean(array()) -> {ok, array()} | {error, term()}.

mean(A, Axis)

-spec mean(array(), list()) -> {ok, array()} | {error, term()}.

mean(A, Axis, Keepdims)

-spec mean(array(), list(), boolean()) -> {ok, array()} | {error, term()}.

min(A)

-spec min(array()) -> {ok, array()} | {error, term()}.

min(A, Axis)

-spec min(array(), list()) -> {ok, array()} | {error, term()}.

min(A, Axis, Keepdims)

-spec min(array(), list(), boolean()) -> {ok, array()} | {error, term()}.

minimum(A, B)

-spec minimum(array(), array()) -> {ok, array()} | {error, term()}.

multiply(A, B)

-spec multiply(array(), array()) -> {ok, array()} | {error, term()}.

ndim(Array)

-spec ndim(array()) -> {ok, integer()} | {error, term()}.

negative(A)

-spec negative(array()) -> {ok, array()} | {error, term()}.

not_equal(A, B)

-spec not_equal(array(), array()) -> {ok, array()} | {error, term()}.

ones(Shape, Dtype)

-spec ones(shape(), dtype()) -> {ok, array()} | {error, term()}.

outer(A, B)

-spec outer(array(), array()) -> {ok, array()} | {error, term()}.

power(A, B)

-spec power(array(), array()) -> {ok, array()} | {error, term()}.

random_normal(Shape, Dtype)

-spec random_normal(shape(), dtype()) -> {ok, array()} | {error, term()}.

random_randint(Low, High, Shape)

-spec random_randint(number(), number(), shape()) -> {ok, array()} | {error, term()}.

random_seed(Seed)

-spec random_seed(integer()) -> ok | {error, term()}.

random_uniform(Shape, Dtype)

-spec random_uniform(shape(), dtype()) -> {ok, array()} | {error, term()}.

reciprocal(A)

-spec reciprocal(array()) -> {ok, array()} | {error, term()}.

remainder(A, B)

-spec remainder(array(), array()) -> {ok, array()} | {error, term()}.

reshape(A, Shape)

-spec reshape(array(), shape()) -> {ok, array()} | {error, term()}.

right_shift(A, B)

-spec right_shift(array(), array()) -> {ok, array()} | {error, term()}.

round(A, Decimals)

-spec round(array(), integer()) -> {ok, array()} | {error, term()}.

rsqrt(A)

-spec rsqrt(array()) -> {ok, array()} | {error, term()}.

set_default_device(Device)

-spec set_default_device(device()) -> ok | {error, term()}.

shape(Array)

-spec shape(array()) -> {ok, shape()} | {error, term()}.

sigmoid(A)

-spec sigmoid(array()) -> {ok, array()} | {error, term()}.

sign(A)

-spec sign(array()) -> {ok, array()} | {error, term()}.

sin(A)

-spec sin(array()) -> {ok, array()} | {error, term()}.

sinh(A)

-spec sinh(array()) -> {ok, array()} | {error, term()}.

size(Array)

-spec size(array()) -> {ok, integer()} | {error, term()}.

softmax(A, Axis)

-spec softmax(array(), integer()) -> {ok, array()} | {error, term()}.

sort(A)

-spec sort(array()) -> {ok, array()} | {error, term()}.

sort(A, Axis)

-spec sort(array(), integer()) -> {ok, array()} | {error, term()}.

split(A, Indices, Axis)

-spec split(array(), list(), integer()) -> {ok, list()} | {error, term()}.

sqrt(A)

-spec sqrt(array()) -> {ok, array()} | {error, term()}.

square(A)

-spec square(array()) -> {ok, array()} | {error, term()}.

squeeze(A)

-spec squeeze(array()) -> {ok, array()} | {error, term()}.

squeeze(A, Axis)

-spec squeeze(array(), list()) -> {ok, array()} | {error, term()}.

stack(Arrays, Axis)

-spec stack(list(), integer()) -> {ok, array()} | {error, term()}.

std(A)

-spec std(array()) -> {ok, array()} | {error, term()}.

std(A, Axis)

-spec std(array(), list()) -> {ok, array()} | {error, term()}.

std(A, Axis, Keepdims)

-spec std(array(), list(), boolean()) -> {ok, array()} | {error, term()}.

std(A, Axis, Keepdims, Ddof)

-spec std(array(), list(), boolean(), integer()) -> {ok, array()} | {error, term()}.

subtract(A, B)

-spec subtract(array(), array()) -> {ok, array()} | {error, term()}.

sum(A)

-spec sum(array()) -> {ok, array()} | {error, term()}.

sum(A, Axis)

-spec sum(array(), list()) -> {ok, array()} | {error, term()}.

sum(A, Axis, Keepdims)

-spec sum(array(), list(), boolean()) -> {ok, array()} | {error, term()}.

tan(A)

-spec tan(array()) -> {ok, array()} | {error, term()}.

tanh(A)

-spec tanh(array()) -> {ok, array()} | {error, term()}.

tensordot(A, B, Axes)

-spec tensordot(array(), array(), integer()) -> {ok, array()} | {error, term()}.

test_basic()

-spec test_basic() -> ok | {error, term()}.

to_list(Array)

-spec to_list(array()) -> {ok, list()} | {error, term()}.

transpose(A)

-spec transpose(array()) -> {ok, array()} | {error, term()}.

transpose(A, Axes)

-spec transpose(array(), list()) -> {ok, array()} | {error, term()}.

var(A)

-spec var(array()) -> {ok, array()} | {error, term()}.

var(A, Axis)

-spec var(array(), list()) -> {ok, array()} | {error, term()}.

var(A, Axis, Keepdims)

-spec var(array(), list(), boolean()) -> {ok, array()} | {error, term()}.

var(A, Axis, Keepdims, Ddof)

-spec var(array(), list(), boolean(), integer()) -> {ok, array()} | {error, term()}.

version()

-spec version() -> {ok, string()} | {error, term()}.

where(Condition, X, Y)

-spec where(array(), array(), array()) -> {ok, array()} | {error, term()}.

zeros(Shape, Dtype)

-spec zeros(shape(), dtype()) -> {ok, array()} | {error, term()}.