You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perform type conversion for as_slice (Unlike item(), we cannot use mlx_astype on the inner pointer here because it creates a new mlx_array which should be freed at the end of this fn, making it the returned slice pointing at a temporary value.)
Split as_slice into three versions
as_slice<T>(&self) -> &[T] - checks if the inner dtype is the same as the output dtype, panics if different. Also panics if pointer is null
as_slice_unchecked<T>(&self) -> &[T] - unsafe and does not perform any check
try_as_slice<T>(&self) -> Result<&[T], Error> - checks the type and returns an error if the types don't match or ptr is null
Avoid direct use of the Add or Sub operators (ie. +, +=, -, -=), use alternatives like saturating_add etc instead. This is probably not needed anymore with the new error handling
Which should be used then? saturating_*, checked_*, overflowing_*, unchecked_*, wrapping_*
The ops macros could probably be generated automatically. However, declarative macros cannot be defined in impl or trait blocks.
Review args that take ownership of Array to check if they really need ownership (if all they need is a ref, change them to .as_ref() in the corresponding macros)
Review default dtype (with python) for factory ops macros
Initial implementation steps
sorting
related ops #66)shapes
)IndexMutOp
#65)Problems found
mlx
is lazyitem()
Perform type conversion for(Unlikeas_slice
item()
, we cannot usemlx_astype
on the inner pointer here because it creates a newmlx_array
which should be freed at the end of this fn, making it the returned slice pointing at a temporary value.)as_slice
into three versionsas_slice<T>(&self) -> &[T]
- checks if the inner dtype is the same as the output dtype, panics if different. Also panics if pointer is nullas_slice_unchecked<T>(&self) -> &[T]
- unsafe and does not perform any checktry_as_slice<T>(&self) -> Result<&[T], Error>
- checks the type and returns an error if the types don't match or ptr is nullmlx
allows out of bound indexing (Possible mx.array bug? ml-explore/mlx#206)Revisit all error types (when everything is more or less ready)not needed with the new error handlingRevisit whethernot needed with the new error handling*_unchecked
functions should beunsafe
eval()
(https://ml-explore.github.io/mlx/build/html/usage/lazy_evaluation.html)eval()
onmlx_array
ormlx_vector_array
multiple times is allowed (is&mut
really required)eval()
takes place on the c++ sideeval()
) WhetherArray
should beSend
and/orSync
(implSend
forArray
& fix broken links in docs #64)Clone
forArray
PartialEq
forArray
usingarray_eq
Avoid direct use of theThis is probably not needed anymore with the new error handlingAdd
orSub
operators (ie.+
,+=
,-
,-=
), use alternatives likesaturating_add
etc instead.Which should be used then?saturating_*
,checked_*
,overflowing_*
,unchecked_*
,wrapping_*
impl
or trait blocks.Array
to check if they really need ownership (if all they need is a ref, change them to.as_ref()
in the corresponding macros)arange
is missing from the constructors forArray
(feat(api): addarange
#72)as_slice
when the underlying array is not contiguous #77impl ScalarOrArray
as argument? (seeScalarOrArray
in the swift binidng)index
andindex_mut
is necessaryFrom<complex64>
forArray
The text was updated successfully, but these errors were encountered: