pub struct Array { /* private fields */ }Expand description
An n-dimensional array.
Implementations§
Source§impl Array
impl Array
Sourcepub unsafe fn from_ptr(c_array: mlx_array) -> Array
pub unsafe fn from_ptr(c_array: mlx_array) -> Array
Create a new array from an existing mlx_array pointer.
§Safety
c_array must be a valid, independently owned MLX array handle. Array takes ownership
of that handle and frees it on drop. A borrowed handle, such as one returned by
Array::as_ptr, must first be duplicated into a fresh handle with
[mlx_sys::mlx_array_set].
use mlx_rs::Array;
let source = Array::from_int(1);
let duplicate = unsafe {
let mut handle = mlx_sys::mlx_array_new();
assert_eq!(mlx_sys::mlx_array_set(&mut handle, source.as_ptr()), 0);
Array::from_ptr(handle)
};
assert_eq!(duplicate.item_exact::<i32>(), 1);Sourcepub fn from_complex(val: complex64) -> Array
pub fn from_complex(val: complex64) -> Array
New array from a complex scalar.
Sourcepub fn from_slice<T: FromSliceElement>(data: &[T], shape: &[i32]) -> Self
pub fn from_slice<T: FromSliceElement>(data: &[T], shape: &[i32]) -> Self
New array from existing buffer.
Please note that floating point literals are treated as f32 instead of
f64. Use Array::from_slice_f64 for f64.
§Parameters
data: A buffer which will be copied.shape: Shape of the array.
§Panic
- Panics if the product of the shape is not equal to the length of the data.
- Panics if the shape is too large.
Sourcepub fn from_slice_f64(data: &[f64], shape: &[i32]) -> Self
pub fn from_slice_f64(data: &[f64], shape: &[i32]) -> Self
New array from a slice of f64.
A separate method is provided for f64 because f64 is not supported on GPU and rust defaults to f64 for floating point literals
Sourcepub unsafe fn from_raw_data(
data: *const c_void,
shape: &[i32],
dtype: Dtype,
) -> Self
pub unsafe fn from_raw_data( data: *const c_void, shape: &[i32], dtype: Dtype, ) -> Self
Create a new array from raw data buffer.
This is a convenience wrapper around [mlx_sy::mlx_array_new_data].
§Safety
This is unsafe because the caller must ensure that the data buffer is valid and that the shape is correct.
Sourcepub fn from_iter<I: IntoIterator<Item = T>, T: FromSliceElement>(
iter: I,
shape: &[i32],
) -> Self
pub fn from_iter<I: IntoIterator<Item = T>, T: FromSliceElement>( iter: I, shape: &[i32], ) -> Self
New array from an iterator.
Please note that floating point literals are treated as f32 instead of
f64. Use Array::from_iter_f64 for f64.
This is a convenience method that is equivalent to
let data: Vec<T> = iter.collect();
Array::from_slice(&data, shape)§Example
use mlx_rs::Array;
let data = vec![1i32, 2, 3, 4, 5];
let mut array = Array::from_iter(data.clone(), &[5]);
assert_eq!(array.as_slice::<i32>(), &data[..]);Sourcepub fn from_iter_f64<I: IntoIterator<Item = f64>>(
iter: I,
shape: &[i32],
) -> Self
pub fn from_iter_f64<I: IntoIterator<Item = f64>>( iter: I, shape: &[i32], ) -> Self
New array from an iterator of f64.
A separate method is provided for f64 because f64 is not supported on GPU and rust defaults to f64 for floating point literals
Sourcepub fn shape(&self) -> &[i32]
pub fn shape(&self) -> &[i32]
The shape of the array.
Returns: a pointer to the sizes of each dimension.
Sourcepub fn dim(&self, dim: i32) -> i32
pub fn dim(&self, dim: i32) -> i32
The shape of the array in a particular dimension.
§Panic
- Panics if the array is scalar.
- Panics if
dimis negative anddim + ndimoverflows - Panics if the dimension is out of bounds.
Sourcepub fn item_exact<T: ArrayElement>(&self) -> T
pub fn item_exact<T: ArrayElement>(&self) -> T
Access the value of a scalar array without dtype conversion.
This evaluates the array and panics if evaluation fails, the array is not scalar, or T
does not exactly match the array dtype.
Sourcepub fn try_item_exact<T: ArrayElement>(&self) -> Result<T, ConversionError>
pub fn try_item_exact<T: ArrayElement>(&self) -> Result<T, ConversionError>
Access the value of a scalar array without dtype conversion.
This evaluates the array and returns an error if evaluation fails, the array is not scalar,
or T does not exactly match the array dtype.
Sourcepub fn item_cast<T: ArrayElement>(&self) -> T
pub fn item_cast<T: ArrayElement>(&self) -> T
Access the value of a scalar array, converting it to T when necessary.
This evaluates the array and panics if evaluation or conversion fails or the array is not scalar.
Sourcepub fn try_item_cast<T: ArrayElement>(&self) -> Result<T, ConversionError>
pub fn try_item_cast<T: ArrayElement>(&self) -> Result<T, ConversionError>
Access the value of a scalar array, converting it to T when necessary.
This evaluates the array and returns an error if evaluation or conversion fails or the array is not scalar.
Sourcepub fn item<T: ArrayElement>(&self) -> T
👎Deprecated since 0.26.0: use item_cast or item_exact
pub fn item<T: ArrayElement>(&self) -> T
use item_cast or item_exact
Compatibility alias for Array::item_cast.
Sourcepub fn try_item<T: ArrayElement>(&self) -> Result<T>
👎Deprecated since 0.26.0: use try_item_cast or try_item_exact
pub fn try_item<T: ArrayElement>(&self) -> Result<T>
use try_item_cast or try_item_exact
Compatibility alias for Array::try_item_cast.
Sourcepub fn to_vec_exact<T: ArrayElement + Clone>(
&self,
) -> Result<Vec<T>, ConversionError>
pub fn to_vec_exact<T: ArrayElement + Clone>( &self, ) -> Result<Vec<T>, ConversionError>
Copy contiguous row-major array values without dtype conversion.
This evaluates the array and allocates a Vec. It returns an error if T does not exactly
match the array dtype or if the array is not contiguous row-major. Call
Array::contiguous first to materialize a row-major array.
Sourcepub fn to_vec_cast<T: ArrayElement + Clone>(
&self,
) -> Result<Vec<T>, ConversionError>
pub fn to_vec_cast<T: ArrayElement + Clone>( &self, ) -> Result<Vec<T>, ConversionError>
Copy contiguous row-major array values, converting them to T when necessary.
This evaluates the array, may allocate a converted MLX array, and allocates a Vec. It
returns an error if evaluation or conversion fails or if the converted array is not
contiguous row-major. Call Array::contiguous first to materialize a row-major array.
Sourcepub unsafe fn as_slice_unchecked<T: ArrayElement>(&self) -> &[T]
pub unsafe fn as_slice_unchecked<T: ArrayElement>(&self) -> &[T]
Returns a slice of the array data without validating the dtype.
§Safety
This is unsafe because the underlying data ptr is not checked for null or if the desired dtype matches the actual dtype of the array.
§Example
use mlx_rs::Array;
let data = [1i32, 2, 3, 4, 5];
let mut array = Array::from_slice(&data[..], &[5]);
unsafe {
let slice = array.as_slice_unchecked::<i32>();
assert_eq!(slice, &[1, 2, 3, 4, 5]);
}Sourcepub fn try_as_slice<T: ArrayElement>(&self) -> Result<&[T], AsSliceError>
pub fn try_as_slice<T: ArrayElement>(&self) -> Result<&[T], AsSliceError>
Returns a slice of contiguous row-major array data.
Returns an error if the dtype does not match or the array is a non-contiguous view. Call
Array::contiguous first to materialize a row-major array.
§Example
use mlx_rs::Array;
let data = [1i32, 2, 3, 4, 5];
let mut array = Array::from_slice(&data[..], &[5]);
let slice = array.try_as_slice::<i32>();
assert_eq!(slice, Ok(&data[..]));Sourcepub fn as_slice<T: ArrayElement>(&self) -> &[T]
pub fn as_slice<T: ArrayElement>(&self) -> &[T]
Returns a slice of contiguous row-major array data.
§Panics
Panics if evaluation fails, the desired dtype does not match the actual dtype, or the array
is not contiguous row-major. Call Array::contiguous first for non-contiguous views.
§Example
use mlx_rs::Array;
let data = [1i32, 2, 3, 4, 5];
let mut array = Array::from_slice(&data[..], &[5]);
let slice = array.as_slice::<i32>();
assert_eq!(slice, &data[..]);Sourcepub fn deep_clone(&self) -> Self
pub fn deep_clone(&self) -> Self
Clone the array by copying the data.
This is named deep_clone to avoid confusion with the Clone trait.
Source§impl Array
impl Array
Sourcepub fn diff(&self, n: i32, axis: i32) -> Result<Array>
pub fn diff(&self, n: i32, axis: i32) -> Result<Array>
Apply adjacent subtraction n times along axis.
n == 0 returns an identity result. MLX does not provide prepend or append operands for
this operation.
use mlx_rs::array;
let output = array!([1, 4, 9]).diff(1, -1).unwrap();
assert_eq!(output.shape(), &[2]);Sourcepub fn trunc(&self) -> Result<Array>
pub fn trunc(&self) -> Result<Array>
Round floating-point values toward zero.
Signed zero is preserved, integers are unchanged, and complex inputs are rejected.
use mlx_rs::array;
let output = array!([-1.75, 2.25]).trunc().unwrap();
assert_eq!(output.shape(), &[2]);Sourcepub fn abs(&self) -> Result<Array>
pub fn abs(&self) -> Result<Array>
Element-wise absolute value.
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[1i32, 2, -3, -4, -5], &[5]);
let mut result = array.abs().unwrap();
let data: &[i32] = result.as_slice();
// data == [1, 2, 3, 4, 5]Sourcepub fn abs_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around abs
pub fn abs_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around abs
Compatibility shim for abs.
Sourcepub fn add(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn add(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise addition returning an error if arrays are not broadcastable.
Add two arrays with broadcasting.
§Params
- other: array to add
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 3.0], &[3]);
let b = Array::from_slice(&[4.0, 5.0, 6.0], &[3]);
let mut c = a.add(&b).unwrap();
let c_data: &[f32] = c.as_slice();
// c_data == [5.0, 7.0, 9.0]Sourcepub fn add_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around add
pub fn add_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around add
Compatibility shim for add.
Sourcepub fn subtract(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn subtract(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise subtraction returning an error if arrays are not broadcastable.
Subtract two arrays with broadcasting.
§Params
- other: array to subtract
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 3.0], &[3]);
let b = Array::from_slice(&[4.0, 5.0, 6.0], &[3]);
let mut c = a.subtract(&b).unwrap();
let c_data: &[f32] = c.as_slice();
// c_data == [-3.0, -3.0, -3.0]Sourcepub fn subtract_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around subtract
pub fn subtract_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around subtract
Compatibility shim for subtract.
Sourcepub fn negative(&self) -> Result<Array>
pub fn negative(&self) -> Result<Array>
Unary element-wise negation. Returns an error if the array is of type bool.
Negate the values in the array.
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 3.0], &[3]);
let mut b = a.negative().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [-1.0, -2.0, -3.0]Sourcepub fn negative_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around negative
pub fn negative_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around negative
Compatibility shim for negative.
Sourcepub fn multiply(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn multiply(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise multiplication returning an error if arrays are not broadcastable.
Multiply two arrays with broadcasting.
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 3.0], &[3]);
let b = Array::from_slice(&[4.0, 5.0, 6.0], &[3]);
let mut c = a.multiply(&b).unwrap();
let c_data: &[f32] = c.as_slice();
// c_data == [4.0, 10.0, 18.0]Sourcepub fn multiply_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around multiply
pub fn multiply_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around multiply
Compatibility shim for multiply.
Sourcepub fn nan_to_num(
&self,
nan: impl IntoOption<f32>,
pos_inf: impl IntoOption<f32>,
neg_inf: impl IntoOption<f32>,
) -> Result<Array>
pub fn nan_to_num( &self, nan: impl IntoOption<f32>, pos_inf: impl IntoOption<f32>, neg_inf: impl IntoOption<f32>, ) -> Result<Array>
Replace NaN and Inf values with finite numbers.
§Params
- nan: value to replace NaN with
- posInf: value to replace positive inifinites with. If not specified will use the largest finite value for the given dtype.
- negInf: value to replace negative inifinites with. If not specified will use the negative of the largest finite value for the given dtype.
- stream: stream or device to evaluate on
Sourcepub fn nan_to_num_device(
&self,
nan: impl IntoOption<f32>,
pos_inf: impl IntoOption<f32>,
neg_inf: impl IntoOption<f32>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around nan_to_num
pub fn nan_to_num_device( &self, nan: impl IntoOption<f32>, pos_inf: impl IntoOption<f32>, neg_inf: impl IntoOption<f32>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around nan_to_num
Compatibility shim for [nan_to_num].
Sourcepub fn divide(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn divide(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise division returning an error if arrays are not broadcastable.
Divide two arrays with broadcasting.
§Params
- other: array to divide
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 3.0], &[3]);
let b = Array::from_slice(&[4.0, 5.0, 6.0], &[3]);
let mut c = a.divide(&b).unwrap();
let c_data: &[f32] = c.as_slice();
// c_data == [0.25, 0.4, 0.5]Sourcepub fn divide_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around divide
pub fn divide_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around divide
Compatibility shim for divide.
Sourcepub fn power(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn power(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise power operation returning an error if arrays are not broadcastable if they have different shapes.
Raise the elements of the array to the power of the elements of another array.
§Params
- other: array to raise to the power of
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 3.0], &[3]);
let b = Array::from_slice(&[2.0, 3.0, 4.0], &[3]);
let mut c = a.power(&b).unwrap();
let c_data: &[f32] = c.as_slice();
// c_data == [1.0, 8.0, 81.0]Sourcepub fn power_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around power
pub fn power_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around power
Compatibility shim for power.
Sourcepub fn remainder(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn remainder(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise remainder of division returning an error if arrays are not broadcastable.
Computes the remainder of dividing lhs with rhs with broadcasting.
§Params
- other: array to divide
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[10.0, 11.0, 12.0], &[3]);
let b = Array::from_slice(&[3.0, 4.0, 5.0], &[3]);
let mut c = a.remainder(&b).unwrap();
let c_data: &[f32] = c.as_slice();
// c_data == [1.0, 3.0, 2.0]Sourcepub fn remainder_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around remainder
pub fn remainder_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around remainder
Compatibility shim for remainder.
Sourcepub fn sqrt(&self) -> Result<Array>
pub fn sqrt(&self) -> Result<Array>
Element-wise square root
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 4.0, 9.0], &[3]);
let mut b = a.sqrt().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [1.0, 2.0, 3.0]Sourcepub fn sqrt_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around sqrt
pub fn sqrt_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around sqrt
Compatibility shim for sqrt.
Sourcepub fn cos(&self) -> Result<Array>
pub fn cos(&self) -> Result<Array>
Element-wise cosine
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[0.0, 1.0, 2.0], &[3]);
let mut b = a.cos().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [1.0, 0.54030234, -0.41614687]Sourcepub fn cos_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around cos
pub fn cos_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around cos
Compatibility shim for cos.
Sourcepub fn exp(&self) -> Result<Array>
pub fn exp(&self) -> Result<Array>
Element-wise exponential.
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[0.0, 1.0, 2.0], &[3]);
let a = Array::from_slice(&[0.0, 1.0, 2.0], &[3]);
let mut b = a.exp().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [1.0, 2.7182817, 7.389056]Sourcepub fn exp_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around exp
pub fn exp_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around exp
Compatibility shim for exp.
Sourcepub fn floor(&self) -> Result<Array>
pub fn floor(&self) -> Result<Array>
Element-wise floor returning an error if the array is of type complex64.
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[0.1, 1.9, 2.5], &[3]);
let mut b = a.floor().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [0.0, 1.0, 2.0]Sourcepub fn floor_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around floor
pub fn floor_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around floor
Compatibility shim for floor.
Sourcepub fn floor_divide(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn floor_divide(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise integer division returning an error if arrays are not broadcastable.
Divide two arrays with broadcasting.
If either array is a floating point type then it is equivalent to calling Array::floor()
after /.
§Params
- other: array to divide
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 3.0], &[3]);
let b = Array::from_slice(&[4.0, 5.0, 6.0], &[3]);
let mut c = a.floor_divide(&b).unwrap();
let c_data: &[f32] = c.as_slice();
// c_data == [0.25, 0.4, 0.5]Sourcepub fn floor_divide_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around floor_divide
pub fn floor_divide_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around floor_divide
Compatibility shim for floor_divide.
Sourcepub fn is_nan(&self) -> Result<Array>
pub fn is_nan(&self) -> Result<Array>
Return a boolean array indicating which elements are NaN.
§Params
- stream: stream or device to evaluate on
Sourcepub fn is_nan_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around is_nan
pub fn is_nan_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around is_nan
Compatibility shim for [is_nan].
Sourcepub fn is_inf(&self) -> Result<Array>
pub fn is_inf(&self) -> Result<Array>
Return a boolean array indicating which elements are infinity.
§Params
- stream: stream or device to evaluate on
Sourcepub fn is_inf_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around is_inf
pub fn is_inf_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around is_inf
Compatibility shim for [is_inf].
Sourcepub fn is_finite(&self) -> Result<Array>
pub fn is_finite(&self) -> Result<Array>
Return a boolean array indicating which elements are finite.
§Params
- stream: stream or device to evaluate on
Sourcepub fn is_finite_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around is_finite
pub fn is_finite_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around is_finite
Compatibility shim for [is_finite].
Sourcepub fn is_neg_inf(&self) -> Result<Array>
pub fn is_neg_inf(&self) -> Result<Array>
Return a boolean array indicating which elements are negative infinity.
§Params
- stream: stream or device to evaluate on
Sourcepub fn is_neg_inf_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around is_neg_inf
pub fn is_neg_inf_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around is_neg_inf
Compatibility shim for [is_neg_inf].
Sourcepub fn is_pos_inf(&self) -> Result<Array>
pub fn is_pos_inf(&self) -> Result<Array>
Return a boolean array indicating which elements are positive infinity.
§Params
- stream: stream or device to evaluate on
Sourcepub fn is_pos_inf_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around is_pos_inf
pub fn is_pos_inf_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around is_pos_inf
Compatibility shim for [is_pos_inf].
Sourcepub fn log(&self) -> Result<Array>
pub fn log(&self) -> Result<Array>
Element-wise natural logarithm.
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 3.0], &[3]);
let mut b = a.log().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [0.0, 0.6931472, 1.0986123]Sourcepub fn log_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around log
pub fn log_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around log
Compatibility shim for log.
Sourcepub fn log2(&self) -> Result<Array>
pub fn log2(&self) -> Result<Array>
Element-wise base-2 logarithm.
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 4.0, 8.0], &[4]);
let mut b = a.log2().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [0.0, 1.0, 2.0, 3.0]Sourcepub fn log2_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around log2
pub fn log2_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around log2
Compatibility shim for log2.
Sourcepub fn log10(&self) -> Result<Array>
pub fn log10(&self) -> Result<Array>
Element-wise base-10 logarithm.
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 10.0, 100.0], &[3]);
let mut b = a.log10().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [0.0, 1.0, 2.0]Sourcepub fn log10_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around log10
pub fn log10_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around log10
Compatibility shim for log10.
Sourcepub fn log1p(&self) -> Result<Array>
pub fn log1p(&self) -> Result<Array>
Element-wise natural log of one plus the array.
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 3.0], &[3]);
let mut b = a.log1p().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [0.6931472, 1.0986123, 1.3862944]Sourcepub fn log1p_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around log1p
pub fn log1p_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around log1p
Compatibility shim for log1p.
Sourcepub fn matmul(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn matmul(&self, other: impl AsRef<Array>) -> Result<Array>
Matrix multiplication returning an error if inputs are not valid.
Perform the (possibly batched) matrix multiplication of two arrays. This function supports broadcasting for arrays with more than two dimensions.
- If the first array is 1-D then a 1 is prepended to its shape to make it a matrix. Similarly, if the second array is 1-D then a 1 is appended to its shape to make it a matrix. In either case the singleton dimension is removed from the result.
- A batched matrix multiplication is performed if the arrays have more than 2 dimensions. The matrix dimensions for the matrix product are the last two dimensions of each input.
- All but the last two dimensions of each input are broadcast with one another using standard broadcasting.
§Params
- other: array to multiply
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1, 2, 3, 4], &[2, 2]);
let b = Array::from_slice(&[-5.0, 37.5, 4., 7., 1., 0.], &[2, 3]);
// produces a [2, 3] result
let mut c = a.matmul(&b);Sourcepub fn matmul_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around matmul
pub fn matmul_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around matmul
Compatibility shim for matmul.
Sourcepub fn reciprocal(&self) -> Result<Array>
pub fn reciprocal(&self) -> Result<Array>
Element-wise reciprocal.
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1.0, 2.0, 4.0], &[3]);
let mut b = a.reciprocal().unwrap();
let b_data: &[f32] = b.as_slice();
// b_data == [1.0, 0.5, 0.25]Sourcepub fn reciprocal_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around reciprocal
pub fn reciprocal_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around reciprocal
Compatibility shim for reciprocal.
Sourcepub fn round(&self, decimals: impl Into<Option<i32>>) -> Result<Array>
pub fn round(&self, decimals: impl Into<Option<i32>>) -> Result<Array>
Round to the given number of decimals.
§Params
- decimals: number of decimals to round to - default is 0 if not provided
Sourcepub fn round_device(
&self,
decimals: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around round
pub fn round_device( &self, decimals: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around round
Compatibility shim for round.
Sourcepub fn rsqrt_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around rsqrt
pub fn rsqrt_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around rsqrt
Compatibility shim for rsqrt.
Sourcepub fn sin_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around sin
pub fn sin_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around sin
Compatibility shim for sin.
Sourcepub fn square_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around square
pub fn square_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around square
Compatibility shim for square.
Source§impl Array
impl Array
Sourcepub fn to_fp8(&self) -> Result<Array>
pub fn to_fp8(&self) -> Result<Array>
Convert an array to FP8 (E4M3) format.
The input array must be a floating point type (float32, float16, or bfloat16). Values outside the representable range of FP8 E4M3 (-448 to 448) will be clipped.
§Returns
An array with dtype uint8 containing the FP8 E4M3 encoded values.
Sourcepub fn to_fp8_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around to_fp8
pub fn to_fp8_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around to_fp8
Compatibility shim for to_fp8.
Sourcepub fn from_fp8(&self, dtype: Dtype) -> Result<Array>
pub fn from_fp8(&self, dtype: Dtype) -> Result<Array>
Convert an FP8 (E4M3) encoded array back to a floating point type.
The input array should be a uint8 array containing FP8 E4M3 encoded values.
§Params
dtype: The target floating point dtype (float32, float16, or bfloat16)
Sourcepub fn from_fp8_device(
&self,
dtype: Dtype,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around from_fp8
pub fn from_fp8_device( &self, dtype: Dtype, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around from_fp8
Compatibility shim for from_fp8.
Sourcepub fn as_type<T: ArrayElement>(&self) -> Result<Array>
pub fn as_type<T: ArrayElement>(&self) -> Result<Array>
Create a new array with the contents converted to the given ArrayElement type.
§Example
use mlx_rs::{Array, Dtype};
let array = Array::from_slice(&[1i16,2,3], &[3]);
let mut new_array = array.as_type::<f32>().unwrap();
assert_eq!(new_array.dtype(), Dtype::Float32);
assert_eq!(new_array.shape(), &[3]);
assert_eq!(new_array.item_size(), 4);
assert_eq!(new_array.as_slice::<f32>(), &[1.0,2.0,3.0]);Sourcepub fn as_type_device<T: ArrayElement>(
&self,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around as_type
pub fn as_type_device<T: ArrayElement>( &self, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around as_type
Compatibility shim for [as_type].
Sourcepub fn as_dtype(&self, dtype: Dtype) -> Result<Array>
pub fn as_dtype(&self, dtype: Dtype) -> Result<Array>
Same as as_type but with a Dtype argument.
Sourcepub fn as_dtype_device(
&self,
dtype: Dtype,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around as_dtype
pub fn as_dtype_device( &self, dtype: Dtype, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around as_dtype
Compatibility shim for [as_dtype].
Sourcepub fn view<T: ArrayElement>(&self) -> Result<Array>
pub fn view<T: ArrayElement>(&self) -> Result<Array>
View the array as a different type.
The output array will change along the last axis if the input array’s type and the output array’s type do not have the same size.
Note: the view op does not imply that the input and output arrays share their underlying data. The view only guarantees that the binary representation of each element (or group of elements) is the same.
Sourcepub fn view_device<T: ArrayElement>(
&self,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around view
pub fn view_device<T: ArrayElement>( &self, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around view
Compatibility shim for [view].
Source§impl Array
impl Array
Sourcepub fn logcumsumexp(&self, options: LogCumsumExpOptions) -> Result<Array>
pub fn logcumsumexp(&self, options: LogCumsumExpOptions) -> Result<Array>
Compute a stable cumulative LogAddExp scan.
This does not form log(cumsum(exp(x))). Exclusive scans use negative infinity as the
shifted seed.
use mlx_rs::{array, ops::LogCumsumExpOptions};
let output = array!([0.0, 1.0, 2.0])
.logcumsumexp(LogCumsumExpOptions::default())
.unwrap();
assert_eq!(output.shape(), &[3]);Sourcepub fn cummax(
&self,
axis: impl Into<Option<i32>>,
reverse: impl Into<Option<bool>>,
inclusive: impl Into<Option<bool>>,
) -> Result<Array>
pub fn cummax( &self, axis: impl Into<Option<i32>>, reverse: impl Into<Option<bool>>, inclusive: impl Into<Option<bool>>, ) -> Result<Array>
Return the cumulative maximum of the elements along the given axis returning an error if the inputs are invalid.
§Params
- axis: Optional axis to compute the cumulative maximum over. If unspecified the cumulative maximum of the flattened array is returned.
- reverse: If true, the cumulative maximum is computed in reverse - defaults to false if unspecified.
- inclusive: If true, the i-th element of the output includes the i-th element of the input - defaults to true if unspecified.
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[5, 8, 4, 9], &[2, 2]);
// result is [[5, 8], [5, 9]] -- cumulative max along the columns
let result = array.cummax(0, None, None).unwrap();Sourcepub fn cummax_device(
&self,
axis: impl Into<Option<i32>>,
reverse: impl Into<Option<bool>>,
inclusive: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around cummax
pub fn cummax_device( &self, axis: impl Into<Option<i32>>, reverse: impl Into<Option<bool>>, inclusive: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around cummax
Compatibility shim for cummax.
Sourcepub fn cummin(
&self,
axis: impl Into<Option<i32>>,
reverse: impl Into<Option<bool>>,
inclusive: impl Into<Option<bool>>,
) -> Result<Array>
pub fn cummin( &self, axis: impl Into<Option<i32>>, reverse: impl Into<Option<bool>>, inclusive: impl Into<Option<bool>>, ) -> Result<Array>
Return the cumulative minimum of the elements along the given axis returning an error if the inputs are invalid.
§Params
- axis: Optional axis to compute the cumulative minimum over. If unspecified the cumulative maximum of the flattened array is returned.
- reverse: If true, the cumulative minimum is computed in reverse - defaults to false if unspecified.
- inclusive: If true, the i-th element of the output includes the i-th element of the input - defaults to true if unspecified.
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[5, 8, 4, 9], &[2, 2]);
// result is [[5, 8], [4, 8]] -- cumulative min along the columns
let result = array.cummin(0, None, None).unwrap();Sourcepub fn cummin_device(
&self,
axis: impl Into<Option<i32>>,
reverse: impl Into<Option<bool>>,
inclusive: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around cummin
pub fn cummin_device( &self, axis: impl Into<Option<i32>>, reverse: impl Into<Option<bool>>, inclusive: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around cummin
Compatibility shim for cummin.
Sourcepub fn cumprod(
&self,
axis: impl Into<Option<i32>>,
reverse: impl Into<Option<bool>>,
inclusive: impl Into<Option<bool>>,
) -> Result<Array>
pub fn cumprod( &self, axis: impl Into<Option<i32>>, reverse: impl Into<Option<bool>>, inclusive: impl Into<Option<bool>>, ) -> Result<Array>
Return the cumulative product of the elements along the given axis returning an error if the inputs are invalid.
§Params
- axis: Optional axis to compute the cumulative product over. If unspecified the cumulative maximum of the flattened array is returned.
- reverse: If true, the cumulative product is computed in reverse - defaults to false if unspecified.
- inclusive: If true, the i-th element of the output includes the i-th element of the input - defaults to true if unspecified.
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[5, 8, 4, 9], &[2, 2]);
// result is [[5, 8], [20, 72]] -- cumulative min along the columns
let result = array.cumprod(0, None, None).unwrap();Sourcepub fn cumprod_device(
&self,
axis: impl Into<Option<i32>>,
reverse: impl Into<Option<bool>>,
inclusive: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around cumprod
pub fn cumprod_device( &self, axis: impl Into<Option<i32>>, reverse: impl Into<Option<bool>>, inclusive: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around cumprod
Compatibility shim for cumprod.
Sourcepub fn cumsum(
&self,
axis: impl Into<Option<i32>>,
reverse: impl Into<Option<bool>>,
inclusive: impl Into<Option<bool>>,
) -> Result<Array>
pub fn cumsum( &self, axis: impl Into<Option<i32>>, reverse: impl Into<Option<bool>>, inclusive: impl Into<Option<bool>>, ) -> Result<Array>
Return the cumulative sum of the elements along the given axis returning an error if the inputs are invalid.
§Params
- axis: Optional axis to compute the cumulative sum over. If unspecified the cumulative maximum of the flattened array is returned.
- reverse: If true, the cumulative sum is computed in reverse - defaults to false if unspecified.
- inclusive: If true, the i-th element of the output includes the i-th element of the input - defaults to true if unspecified.
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[5, 8, 4, 9], &[2, 2]);
// result is [[5, 8], [9, 17]] -- cumulative min along the columns
let result = array.cumsum(0, None, None).unwrap();Source§impl Array
impl Array
Sourcepub fn zeros_device<T: ArrayElement>(
shape: &[i32],
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around zeros
pub fn zeros_device<T: ArrayElement>( shape: &[i32], stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around zeros
Compatibility shim for zeros.
Sourcepub fn ones_device<T: ArrayElement>(
shape: &[i32],
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around ones
pub fn ones_device<T: ArrayElement>( shape: &[i32], stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around ones
Compatibility shim for ones.
Sourcepub fn eye<T: ArrayElement>(
n: i32,
m: Option<i32>,
k: Option<i32>,
) -> Result<Array>
pub fn eye<T: ArrayElement>( n: i32, m: Option<i32>, k: Option<i32>, ) -> Result<Array>
Create an identity matrix or a general diagonal matrix returning an error if params are invalid.
§Params
- n: number of rows in the output
- m: number of columns in the output – equal to
nif not specified - k: index of the diagonal - defaults to 0 if not specified
§Example
use mlx_rs::Array;
// create [10, 10] array with 1's on the diagonal.
let r = Array::eye::<f32>(10, None, None).unwrap();Sourcepub fn eye_device<T: ArrayElement>(
n: i32,
m: Option<i32>,
k: Option<i32>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around eye
pub fn eye_device<T: ArrayElement>( n: i32, m: Option<i32>, k: Option<i32>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around eye
Compatibility shim for eye.
Sourcepub fn full<T: ArrayElement>(
shape: &[i32],
values: impl AsRef<Array>,
) -> Result<Array>
pub fn full<T: ArrayElement>( shape: &[i32], values: impl AsRef<Array>, ) -> Result<Array>
Construct an array with the given value returning an error if shape is invalid.
Constructs an array of size shape filled with values. If values
is an Array it must be broadcasting to the given shape.
§Params
- shape: shape of the output array
- values: values to be broadcast into the array
§Example
use mlx_rs::{Array, array};
// create [5, 4] array filled with 7
let r = Array::full::<f32>(&[5, 4], array!(7.0f32)).unwrap();Sourcepub fn full_device<T: ArrayElement>(
shape: &[i32],
values: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around full
pub fn full_device<T: ArrayElement>( shape: &[i32], values: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around full
Compatibility shim for full.
Sourcepub fn identity_device<T: ArrayElement>(
n: i32,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around identity
pub fn identity_device<T: ArrayElement>( n: i32, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around identity
Compatibility shim for identity.
Sourcepub fn arange<U, T>(
start: impl Into<Option<U>>,
stop: U,
step: impl Into<Option<U>>,
) -> Result<Array>where
U: NumCast,
T: ArrayElement,
pub fn arange<U, T>(
start: impl Into<Option<U>>,
stop: U,
step: impl Into<Option<U>>,
) -> Result<Array>where
U: NumCast,
T: ArrayElement,
Generates ranges of numbers.
Generate numbers in the half-open interval [start, stop) in increments of step.
§Params
start: Starting value which defaults to0.stop: Stopping value.step: Increment which defaults to1.
§Example
use mlx_rs::Array;
// Create a 1-D array with values from 0 to 50
let r = Array::arange::<_, f32>(None, 50, None);Sourcepub fn arange_device<U, T>(
start: impl Into<Option<U>>,
stop: U,
step: impl Into<Option<U>>,
stream: impl AsRef<Stream>,
) -> Result<Array>where
U: NumCast,
T: ArrayElement,
👎Deprecated since 0.26.0: use with_stream or with_device around arange
pub fn arange_device<U, T>(
start: impl Into<Option<U>>,
stop: U,
step: impl Into<Option<U>>,
stream: impl AsRef<Stream>,
) -> Result<Array>where
U: NumCast,
T: ArrayElement,
use with_stream or with_device around arange
Compatibility shim for arange.
Sourcepub fn linspace<U, T>(
start: U,
stop: U,
count: impl Into<Option<i32>>,
) -> Result<Array>where
U: NumCast,
T: ArrayElement,
👎Deprecated since 0.26.0: use ops::linspace with LinspaceOptions
pub fn linspace<U, T>(
start: U,
stop: U,
count: impl Into<Option<i32>>,
) -> Result<Array>where
U: NumCast,
T: ArrayElement,
use ops::linspace with LinspaceOptions
Compatibility shim for linspace with endpoint inclusion.
Sourcepub fn linspace_device<U, T>(
start: U,
stop: U,
count: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>where
U: NumCast,
T: ArrayElement,
👎Deprecated since 0.26.0: use with_stream or with_device around ops::linspace
pub fn linspace_device<U, T>(
start: U,
stop: U,
count: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>where
U: NumCast,
T: ArrayElement,
use with_stream or with_device around ops::linspace
Compatibility shim for linspace.
Sourcepub fn repeat_axis<T: ArrayElement>(
array: Array,
count: i32,
axis: i32,
) -> Result<Array>
pub fn repeat_axis<T: ArrayElement>( array: Array, count: i32, axis: i32, ) -> Result<Array>
Repeat an array along a specified axis returning an error if params are invalid.
§Params
- array: array to repeat
- count: number of times to repeat
- axis: axis to repeat along
§Example
use mlx_rs::Array;
// repeat a [2, 2] array 4 times along axis 1
let source = Array::from_slice(&[0, 1, 2, 3], &[2, 2]);
let r = Array::repeat_axis::<i32>(source, 4, 1).unwrap();Sourcepub fn repeat_axis_device<T: ArrayElement>(
array: Array,
count: i32,
axis: i32,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around repeat_axis
pub fn repeat_axis_device<T: ArrayElement>( array: Array, count: i32, axis: i32, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around repeat_axis
Compatibility shim for repeat_axis.
Sourcepub fn repeat<T: ArrayElement>(array: Array, count: i32) -> Result<Array>
pub fn repeat<T: ArrayElement>(array: Array, count: i32) -> Result<Array>
Repeat a flattened array along axis 0 returning an error if params are invalid.
§Params
- array: array to repeat
- count: number of times to repeat
§Example
use mlx_rs::Array;
// repeat a 4 element array 4 times along axis 0
let source = Array::from_slice(&[0, 1, 2, 3], &[2, 2]);
let r = Array::repeat::<i32>(source, 4).unwrap();Sourcepub fn repeat_device<T: ArrayElement>(
array: Array,
count: i32,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around repeat
pub fn repeat_device<T: ArrayElement>( array: Array, count: i32, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around repeat
Compatibility shim for repeat.
Sourcepub fn tri<T: ArrayElement>(
n: i32,
m: Option<i32>,
k: Option<i32>,
) -> Result<Array>
pub fn tri<T: ArrayElement>( n: i32, m: Option<i32>, k: Option<i32>, ) -> Result<Array>
An array with ones at and below the given diagonal and zeros elsewhere.
§Params
- n: number of rows in the output
- m: number of columns in the output – equal to
nif not specified - k: index of the diagonal – defaults to 0 if not specified
§Example
use mlx_rs::Array;
// [5, 5] array with the lower triangle filled with 1s
let r = Array::tri::<f32>(5, None, None);Source§impl Array
impl Array
Sourcepub fn load_numpy(path: impl AsRef<Path>) -> Result<Array, IoError>
pub fn load_numpy(path: impl AsRef<Path>) -> Result<Array, IoError>
Load array from a binary file in .npy format.
§Params
- path: path of file to load
- stream: stream or device to evaluate on
Sourcepub fn load_numpy_device(
path: impl AsRef<Path>,
stream: impl AsRef<Stream>,
) -> Result<Array, IoError>
👎Deprecated since 0.26.0: use with_stream or with_device around load_numpy
pub fn load_numpy_device( path: impl AsRef<Path>, stream: impl AsRef<Stream>, ) -> Result<Array, IoError>
use with_stream or with_device around load_numpy
Compatibility shim for [load_numpy].
Sourcepub fn load_safetensors(
path: impl AsRef<Path>,
) -> Result<HashMap<String, Array>, IoError>
pub fn load_safetensors( path: impl AsRef<Path>, ) -> Result<HashMap<String, Array>, IoError>
Load dictionary of MLXArray from a safetensors file.
§Params
- path: path of file to load
- stream: stream or device to evaluate on
Sourcepub fn load_safetensors_device(
path: impl AsRef<Path>,
stream: impl AsRef<Stream>,
) -> Result<HashMap<String, Array>, IoError>
👎Deprecated since 0.26.0: use with_stream or with_device around load_safetensors
pub fn load_safetensors_device( path: impl AsRef<Path>, stream: impl AsRef<Stream>, ) -> Result<HashMap<String, Array>, IoError>
use with_stream or with_device around load_safetensors
Compatibility shim for [load_safetensors].
Sourcepub fn load_safetensors_with_metadata(
path: impl AsRef<Path>,
) -> Result<(HashMap<String, Array>, HashMap<String, String>), IoError>
pub fn load_safetensors_with_metadata( path: impl AsRef<Path>, ) -> Result<(HashMap<String, Array>, HashMap<String, String>), IoError>
Load dictionary of MLXArray and metadata [String:String] from a safetensors file.
§Params
- path: path of file to load
- stream: stream or device to evaluate on
Sourcepub fn load_safetensors_with_metadata_device(
path: impl AsRef<Path>,
stream: impl AsRef<Stream>,
) -> Result<(HashMap<String, Array>, HashMap<String, String>), IoError>
👎Deprecated since 0.26.0: use with_stream or with_device around load_safetensors_with_metadata
pub fn load_safetensors_with_metadata_device( path: impl AsRef<Path>, stream: impl AsRef<Stream>, ) -> Result<(HashMap<String, Array>, HashMap<String, String>), IoError>
use with_stream or with_device around load_safetensors_with_metadata
Compatibility shim for [load_safetensors_with_metadata].
Sourcepub fn save_safetensors<'a, I, S, V>(
arrays: I,
metadata: impl Into<Option<&'a HashMap<String, String>>>,
path: impl AsRef<Path>,
) -> Result<(), IoError>
pub fn save_safetensors<'a, I, S, V>( arrays: I, metadata: impl Into<Option<&'a HashMap<String, String>>>, path: impl AsRef<Path>, ) -> Result<(), IoError>
Save dictionary of arrays in safetensors format.
§Params
- arrays: arrays to save
- metadata: metadata to save
- path: path of file to save
- stream: stream or device to evaluate on
Source§impl Array
impl Array
Sourcepub fn eq(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn eq(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise equality returning an error if the arrays are not broadcastable.
Equality comparison on two arrays with broadcasting.
§Params
- other: array to compare
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1, 2, 3], &[3]);
let b = Array::from_slice(&[1, 2, 3], &[3]);
let mut c = a.eq(&b).unwrap();
let c_data: &[bool] = c.as_slice();
// c_data == [true, true, true]Sourcepub fn eq_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around eq
pub fn eq_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around eq
Compatibility shim for eq.
Sourcepub fn le(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn le(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise less than or equal returning an error if the arrays are not broadcastable.
Less than or equal on two arrays with broadcasting.
§Params
- other: array to compare
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1, 2, 3], &[3]);
let b = Array::from_slice(&[1, 2, 3], &[3]);
let mut c = a.le(&b).unwrap();
let c_data: &[bool] = c.as_slice();
// c_data == [true, true, true]Sourcepub fn le_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around le
pub fn le_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around le
Compatibility shim for le.
Sourcepub fn ge(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn ge(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise greater than or equal returning an error if the arrays are not broadcastable.
Greater than or equal on two arrays with broadcasting.
§Params
- other: array to compare
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1, 2, 3], &[3]);
let b = Array::from_slice(&[1, 2, 3], &[3]);
let mut c = a.ge(&b).unwrap();
let c_data: &[bool] = c.as_slice();
// c_data == [true, true, true]Sourcepub fn ge_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around ge
pub fn ge_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around ge
Compatibility shim for ge.
Sourcepub fn ne(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn ne(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise not equal returning an error if the arrays are not broadcastable.
Not equal on two arrays with broadcasting.
§Params
- other: array to compare
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1, 2, 3], &[3]);
let b = Array::from_slice(&[1, 2, 3], &[3]);
let mut c = a.ne(&b).unwrap();
let c_data: &[bool] = c.as_slice();
// c_data == [false, false, false]Sourcepub fn ne_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around ne
pub fn ne_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around ne
Compatibility shim for ne.
Sourcepub fn lt(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn lt(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise less than returning an error if the arrays are not broadcastable.
Less than on two arrays with broadcasting.
§Params
- other: array to compare
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1, 2, 3], &[3]);
let b = Array::from_slice(&[1, 2, 3], &[3]);
let mut c = a.lt(&b).unwrap();
let c_data: &[bool] = c.as_slice();
// c_data == [false, false, false]Sourcepub fn lt_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around lt
pub fn lt_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around lt
Compatibility shim for lt.
Sourcepub fn gt(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn gt(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise greater than returning an error if the arrays are not broadcastable.
Greater than on two arrays with broadcasting.
§Params
- other: array to compare
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[1, 2, 3], &[3]);
let b = Array::from_slice(&[1, 2, 3], &[3]);
let mut c = a.gt(&b).unwrap();
let c_data: &[bool] = c.as_slice();
// c_data == [false, false, false]Sourcepub fn gt_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around gt
pub fn gt_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around gt
Compatibility shim for gt.
Sourcepub fn logical_and(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn logical_and(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise logical and returning an error if the arrays are not broadcastable.
Logical and on two arrays with broadcasting.
§Params
- other: array to compare
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[true, false, true], &[3]);
let b = Array::from_slice(&[true, true, false], &[3]);
let mut c = a.logical_and(&b).unwrap();
let c_data: &[bool] = c.as_slice();
// c_data == [true, false, false]Sourcepub fn logical_and_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around logical_and
pub fn logical_and_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around logical_and
Compatibility shim for logical_and.
Sourcepub fn logical_or(&self, other: impl AsRef<Array>) -> Result<Array>
pub fn logical_or(&self, other: impl AsRef<Array>) -> Result<Array>
Element-wise logical or returning an error if the arrays are not broadcastable.
Logical or on two arrays with broadcasting.
§Params
- other: array to compare
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[true, false, true], &[3]);
let b = Array::from_slice(&[true, true, false], &[3]);
let mut c = a.logical_or(&b).unwrap();
let c_data: &[bool] = c.as_slice();
// c_data == [true, true, true]Sourcepub fn logical_or_device(
&self,
other: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around logical_or
pub fn logical_or_device( &self, other: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around logical_or
Compatibility shim for logical_or.
Sourcepub fn logical_not(&self) -> Result<Array>
pub fn logical_not(&self) -> Result<Array>
Unary element-wise logical not.
§Example
use mlx_rs::Array;
let a: Array = false.into();
let mut b = a.logical_not().unwrap();
let b_data: &[bool] = b.as_slice();
// b_data == [true]Sourcepub fn logical_not_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around logical_not
pub fn logical_not_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around logical_not
Compatibility shim for logical_not.
Sourcepub fn all_close(
&self,
other: impl AsRef<Array>,
rtol: impl Into<Option<f64>>,
atol: impl Into<Option<f64>>,
equal_nan: impl Into<Option<bool>>,
) -> Result<bool>
pub fn all_close( &self, other: impl AsRef<Array>, rtol: impl Into<Option<f64>>, atol: impl Into<Option<f64>>, equal_nan: impl Into<Option<bool>>, ) -> Result<bool>
Approximate comparison of two arrays returning an error if the inputs aren’t valid.
This evaluates the comparison result before returning a Rust bool.
The arrays are considered equal if:
all(abs(a - b) <= (atol + rtol * abs(b)))§Params
- other: array to compare
- rtol: relative tolerance = defaults to 1e-5 when None
- atol: absolute tolerance - defaults to 1e-8 when None
- equal_nan: whether to consider NaNs equal – default is false when None
§Example
use num_traits::Pow;
use mlx_rs::array;
let a = array!([0., 1., 2., 3.]).sqrt().unwrap();
let b = array!([0., 1., 2., 3.]).power(array!(0.5)).unwrap();
assert!(a.all_close(&b, None, None, None).unwrap());Sourcepub fn all_close_device(
&self,
other: impl AsRef<Array>,
rtol: impl Into<Option<f64>>,
atol: impl Into<Option<f64>>,
equal_nan: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<bool>
👎Deprecated since 0.26.0: use with_stream or with_device around all_close
pub fn all_close_device( &self, other: impl AsRef<Array>, rtol: impl Into<Option<f64>>, atol: impl Into<Option<f64>>, equal_nan: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<bool>
use with_stream or with_device around all_close
Compatibility shim for all_close.
Sourcepub fn is_close(
&self,
other: impl AsRef<Array>,
rtol: impl Into<Option<f64>>,
atol: impl Into<Option<f64>>,
equal_nan: impl Into<Option<bool>>,
) -> Result<Array>
pub fn is_close( &self, other: impl AsRef<Array>, rtol: impl Into<Option<f64>>, atol: impl Into<Option<f64>>, equal_nan: impl Into<Option<bool>>, ) -> Result<Array>
Returns a boolean array where two arrays are element-wise equal within a tolerance returning an error if the arrays are not broadcastable.
Infinite values are considered equal if they have the same sign, NaN values are not equal unless
equalNAN is true.
Two values are considered close if:
abs(a - b) <= (atol + rtol * abs(b))Unlike [self.array_eq] this function supports broadcasting.
Sourcepub fn is_close_device(
&self,
other: impl AsRef<Array>,
rtol: impl Into<Option<f64>>,
atol: impl Into<Option<f64>>,
equal_nan: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around is_close
pub fn is_close_device( &self, other: impl AsRef<Array>, rtol: impl Into<Option<f64>>, atol: impl Into<Option<f64>>, equal_nan: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around is_close
Compatibility shim for is_close.
Sourcepub fn array_eq(
&self,
other: impl AsRef<Array>,
equal_nan: impl Into<Option<bool>>,
) -> Result<Array>
👎Deprecated since 0.26.0: use eq_values for a Rust boolean
pub fn array_eq( &self, other: impl AsRef<Array>, equal_nan: impl Into<Option<bool>>, ) -> Result<Array>
use eq_values for a Rust boolean
Array equality check.
Compare two arrays for equality. Returns true iff the arrays have
the same shape and their values are equal. The arrays need not have
the same type to be considered equal.
§Params
- other: array to compare
- equal_nan: whether to consider NaNs equal – default is false when None
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[0, 1, 2, 3], &[4]);
let b = Array::from_slice(&[0., 1., 2., 3.], &[4]);
assert!(a.eq_values(&b).unwrap());Sourcepub fn eq_exact(&self, other: impl AsRef<Array>) -> Result<bool>
pub fn eq_exact(&self, other: impl AsRef<Array>) -> Result<bool>
Compare shape, dtype, and values exactly.
A dtype or shape mismatch returns false without evaluating either array. Otherwise this
evaluates the equality result before returning a Rust bool. NaNs compare unequal.
Sourcepub fn eq_values(&self, other: impl AsRef<Array>) -> Result<bool>
pub fn eq_values(&self, other: impl AsRef<Array>) -> Result<bool>
Compare shape and values exactly while allowing different dtypes.
This evaluates the equality result before returning a Rust bool. NaNs compare unequal.
Sourcepub fn array_eq_device(
&self,
other: impl AsRef<Array>,
equal_nan: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around array_eq
pub fn array_eq_device( &self, other: impl AsRef<Array>, equal_nan: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around array_eq
Compatibility shim for array_eq.
Sourcepub fn any_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn any_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
An or reduction over the given axes returning an error if the axes are invalid.
§Params
- axes: axes to reduce over – defaults to all axes if not provided
- keep_dims: if
truekeep reduced axis as singleton dimension – defaults to false if not provided
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], &[3, 4]);
// will produce a scalar Array with true -- some of the values are non-zero
let all = array.any(None).unwrap();
// produces an Array([true, true, true, true]) -- all rows have non-zeros
let all_rows = array.any_axes(&[0], None).unwrap();Sourcepub fn any_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around any_axes
pub fn any_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around any_axes
Compatibility shim for any_axes.
Sourcepub fn any_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn any_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Similar to any_axes but defaults to all axes.
Sourcepub fn any_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around any_axis
pub fn any_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around any_axis
Compatibility shim for any_axis.
Source§impl Array
impl Array
Sourcepub fn trace(&self, options: TraceOptions) -> Result<Array>
pub fn trace(&self, options: TraceOptions) -> Result<Array>
Sum a selected diagonal.
The diagonal is cast to the requested dtype before reduction. Reduction promotion can therefore produce a different final dtype.
use mlx_rs::{array, ops::TraceOptions, Dtype};
let result = array!([[1.0, 2.0], [3.0, 4.0]])
.trace(TraceOptions {
dtype: Some(Dtype::Int32),
..TraceOptions::default()
})
.unwrap();
assert!(result.shape().is_empty());Sourcepub fn diag(&self, k: impl Into<Option<i32>>) -> Result<Array>
pub fn diag(&self, k: impl Into<Option<i32>>) -> Result<Array>
Extract a diagonal or construct a diagonal matrix.
If self is 1-D then a diagonal matrix is constructed with self on the k-th diagonal. If
self is 2-D then the k-th diagonal is returned.
§Params:
k: the diagonal to extract or constructstream: stream or device to evaluate on
Sourcepub fn diag_device(
&self,
k: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around diag
pub fn diag_device( &self, k: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around diag
Compatibility shim for diag.
Sourcepub fn diagonal(
&self,
offset: impl Into<Option<i32>>,
axis1: impl Into<Option<i32>>,
axis2: impl Into<Option<i32>>,
) -> Result<Array>
pub fn diagonal( &self, offset: impl Into<Option<i32>>, axis1: impl Into<Option<i32>>, axis2: impl Into<Option<i32>>, ) -> Result<Array>
Return specified diagonals.
If self is 2-D, then a 1-D array containing the diagonal at the given offset is returned.
If self has more than two dimensions, then axis1 and axis2 determine the 2D subarrays
from which diagonals are extracted. The new shape is the original shape with axis1 and
axis2 removed and a new dimension inserted at the end corresponding to the diagonal.
§Params:
offset: offset of the diagonal. Can be positive or negativeaxis1: first axis of the 2-D sub-array from which the diagonals should be takenaxis2: second axis of the 2-D sub-array from which the diagonals should be takenstream: stream or device to evaluate on
Sourcepub fn diagonal_device(
&self,
offset: impl Into<Option<i32>>,
axis1: impl Into<Option<i32>>,
axis2: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around diagonal
pub fn diagonal_device( &self, offset: impl Into<Option<i32>>, axis1: impl Into<Option<i32>>, axis2: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around diagonal
Compatibility shim for diagonal.
Sourcepub fn hadamard_transform(&self, scale: impl Into<Option<f32>>) -> Result<Array>
pub fn hadamard_transform(&self, scale: impl Into<Option<f32>>) -> Result<Array>
Perform the Walsh-Hadamard transform along the final axis.
Supports sizes n = m*2^k for m in (1, 12, 20, 28) and 2^k <= 8192
for DType/float32 and 2^k <= 16384 for DType/float16 and DType/bfloat16.
§Params
- scale: scale the output by this factor – default is
1.0/sqrt(array.dim(-1)) - stream: stream to evaluate on.
Source§impl Array
impl Array
Sourcepub fn count_nonzero(&self, options: CountNonzeroOptions) -> Result<Array>
pub fn count_nonzero(&self, options: CountNonzeroOptions) -> Result<Array>
Count values that compare unequal to zero.
The result is the sum of an i32 nonzero mask. An explicitly empty axis list returns that
elementwise mask instead of reducing it.
use mlx_rs::{array, ops::CountNonzeroOptions, Axes, Dtype};
let input = array!([[0, 2], [3, 0]]);
let output = input
.count_nonzero(CountNonzeroOptions {
axes: Axes::Axis(0),
keep_dims: false,
})
.unwrap();
assert_eq!(output.dtype(), Dtype::Int32);Sourcepub fn all_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn all_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
An and reduction over the given axes returning an error if the axes are invalid.
§Params
- axes: The axes to reduce over – defaults to all axes if not provided
- keep_dims: Whether to keep the reduced dimensions – defaults to false if not provided
§Example
use mlx_rs::Array;
let a = Array::from_slice(&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], &[3, 4]);
let mut b = a.all_axes(&[0], None).unwrap();
let results: &[bool] = b.as_slice();
// results == [false, true, true, true]Sourcepub fn all_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around all_axes
pub fn all_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around all_axes
Compatibility shim for all_axes.
Sourcepub fn all_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn all_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Similar to Array::all_axes but only reduces over a single axis.
Sourcepub fn all_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around all_axis
pub fn all_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around all_axis
Compatibility shim for all_axis.
Sourcepub fn all(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
pub fn all(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
Similar to Array::all_axes but reduces over all axes.
Sourcepub fn all_device(
&self,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around all
pub fn all_device( &self, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around all
Compatibility shim for all.
Sourcepub fn prod_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn prod_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
A product reduction over the given axes returning an error if the axes are invalid.
§Params
- axes: axes to reduce over
- keep_dims: Whether to keep the reduced dimensions – defaults to false if not provided
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[5, 8, 4, 9], &[2, 2]);
// result is [20, 72]
let result = array.prod_axes(&[0], None).unwrap();Sourcepub fn prod_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around prod_axes
pub fn prod_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around prod_axes
Compatibility shim for prod_axes.
Sourcepub fn prod_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn prod_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Similar to Array::prod_axes but only reduces over a single axis.
Sourcepub fn prod_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around prod_axis
pub fn prod_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around prod_axis
Compatibility shim for prod_axis.
Sourcepub fn prod(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
pub fn prod(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
Similar to Array::prod_axes but reduces over all axes.
Sourcepub fn prod_device(
&self,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around prod
pub fn prod_device( &self, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around prod
Compatibility shim for prod.
Sourcepub fn max_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn max_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
A max reduction over the given axes returning an error if the axes are invalid.
§Params
- axes: axes to reduce over
- keep_dims: Whether to keep the reduced dimensions – defaults to false if not provided
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[5, 8, 4, 9], &[2, 2]);
// result is [5, 9]
let result = array.max_axes(&[0], None).unwrap();Sourcepub fn max_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around max_axes
pub fn max_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around max_axes
Compatibility shim for max_axes.
Sourcepub fn max_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn max_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Similar to Array::max_axes but only reduces over a single axis.
Sourcepub fn max_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around max_axis
pub fn max_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around max_axis
Compatibility shim for max_axis.
Sourcepub fn max(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
pub fn max(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
Similar to Array::max_axes but reduces over all axes.
Sourcepub fn max_device(
&self,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around max
pub fn max_device( &self, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around max
Compatibility shim for max.
Sourcepub fn sum_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn sum_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Sum reduce the array over the given axes returning an error if the axes are invalid.
§Params
- axes: axes to reduce over
- keep_dims: if
true, keep the reduces axes as singleton dimensions
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[5, 8, 4, 9], &[2, 2]);
// result is [9, 17]
let result = array.sum_axes(&[0], None).unwrap();Sourcepub fn sum_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around sum_axes
pub fn sum_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around sum_axes
Compatibility shim for sum_axes.
Sourcepub fn sum_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn sum_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Similar to Array::sum_axes but only reduces over a single axis.
Sourcepub fn sum_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around sum_axis
pub fn sum_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around sum_axis
Compatibility shim for sum_axis.
Sourcepub fn sum(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
pub fn sum(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
Similar to Array::sum_axes but reduces over all axes.
Sourcepub fn sum_device(
&self,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around sum
pub fn sum_device( &self, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around sum
Compatibility shim for sum.
Sourcepub fn mean_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn mean_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
A mean reduction over the given axes returning an error if the axes are invalid.
§Params
- axes: axes to reduce over
- keep_dims: Whether to keep the reduced dimensions – defaults to false if not provided
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[5, 8, 4, 9], &[2, 2]);
// result is [4.5, 8.5]
let result = array.mean_axes(&[0], None).unwrap();Sourcepub fn mean_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around mean_axes
pub fn mean_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around mean_axes
Compatibility shim for mean_axes.
Sourcepub fn mean_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn mean_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Similar to Array::mean_axes but only reduces over a single axis.
Sourcepub fn mean_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around mean_axis
pub fn mean_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around mean_axis
Compatibility shim for mean_axis.
Sourcepub fn mean(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
pub fn mean(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
Similar to Array::mean_axes but reduces over all axes.
Sourcepub fn mean_device(
&self,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around mean
pub fn mean_device( &self, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around mean
Compatibility shim for mean.
Sourcepub fn min_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn min_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
A min reduction over the given axes returning an error if the axes are invalid.
§Params
- axes: axes to reduce over
- keep_dims: Whether to keep the reduced dimensions – defaults to false if not provided
§Example
use mlx_rs::Array;
let array = Array::from_slice(&[5, 8, 4, 9], &[2, 2]);
// result is [4, 8]
let result = array.min_axes(&[0], None).unwrap();Sourcepub fn min_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around min_axes
pub fn min_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around min_axes
Compatibility shim for min_axes.
Sourcepub fn min_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn min_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Similar to Array::min_axes but only reduces over a single axis.
Sourcepub fn min_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around min_axis
pub fn min_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around min_axis
Compatibility shim for min_axis.
Sourcepub fn min(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
pub fn min(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
Similar to Array::min_axes but reduces over all axes.
Sourcepub fn min_device(
&self,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around min
pub fn min_device( &self, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around min
Compatibility shim for min.
Sourcepub fn var_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
ddof: impl Into<Option<i32>>,
) -> Result<Array>
pub fn var_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ddof: impl Into<Option<i32>>, ) -> Result<Array>
Compute the variance(s) over the given axes returning an error if the axes are invalid.
§Params
- axes: axes to reduce over
- keep_dims: if
true, keep the reduces axes as singleton dimensions - ddof: the divisor to compute the variance is
N - ddof
Sourcepub fn var_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
ddof: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around var_axes
pub fn var_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ddof: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around var_axes
Compatibility shim for var_axes.
Sourcepub fn var_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
ddof: impl Into<Option<i32>>,
) -> Result<Array>
pub fn var_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ddof: impl Into<Option<i32>>, ) -> Result<Array>
Similar to Array::var_axes but only reduces over a single axis.
Sourcepub fn var_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
ddof: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around var_axis
pub fn var_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ddof: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around var_axis
Compatibility shim for var_axis.
Sourcepub fn var(
&self,
keep_dims: impl Into<Option<bool>>,
ddof: impl Into<Option<i32>>,
) -> Result<Array>
pub fn var( &self, keep_dims: impl Into<Option<bool>>, ddof: impl Into<Option<i32>>, ) -> Result<Array>
Similar to Array::var_axes but reduces over all axes.
Sourcepub fn var_device(
&self,
keep_dims: impl Into<Option<bool>>,
ddof: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around var
pub fn var_device( &self, keep_dims: impl Into<Option<bool>>, ddof: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around var
Compatibility shim for var.
Sourcepub fn median_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn median_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Compute the median over the given axes.
§Params
- axes: axes to reduce over
- keep_dims: Whether to keep the reduced dimensions – defaults to false if not provided
Sourcepub fn median_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around median_axes
pub fn median_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around median_axes
Compatibility shim for median_axes.
Sourcepub fn median_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn median_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Similar to Array::median_axes but only reduces over a single axis.
Sourcepub fn median_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around median_axis
pub fn median_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around median_axis
Compatibility shim for median_axis.
Sourcepub fn median(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
pub fn median(&self, keep_dims: impl Into<Option<bool>>) -> Result<Array>
Compute the median over all axes.
Sourcepub fn median_device(
&self,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around median
pub fn median_device( &self, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around median
Compatibility shim for median.
Sourcepub fn logsumexp_axes(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn logsumexp_axes( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
A log-sum-exp reduction over the given axes returning an error if the axes are invalid.
The log-sum-exp reduction is a numerically stable version of using the individual operations.
§Params
- axes: axes to reduce over
- keep_dims: Whether to keep the reduced dimensions – defaults to false if not provided
Sourcepub fn logsumexp_axes_device(
&self,
axes: &[i32],
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around logsumexp_axes
pub fn logsumexp_axes_device( &self, axes: &[i32], keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around logsumexp_axes
Compatibility shim for logsumexp_axes.
Sourcepub fn logsumexp_axis(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
) -> Result<Array>
pub fn logsumexp_axis( &self, axis: i32, keep_dims: impl Into<Option<bool>>, ) -> Result<Array>
Similar to Array::logsumexp_axes but only reduces over a single axis.
Sourcepub fn logsumexp_axis_device(
&self,
axis: i32,
keep_dims: impl Into<Option<bool>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around logsumexp_axis
pub fn logsumexp_axis_device( &self, axis: i32, keep_dims: impl Into<Option<bool>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around logsumexp_axis
Compatibility shim for logsumexp_axis.
Source§impl Array
impl Array
Sourcepub fn contiguous(&self) -> Result<Array>
pub fn contiguous(&self) -> Result<Array>
Return an array that is row-major contiguous after evaluation.
MLX may share the input buffer when it is already suitable.
Sourcepub fn contiguous_with_options(
&self,
options: ContiguousOptions,
) -> Result<Array>
pub fn contiguous_with_options( &self, options: ContiguousOptions, ) -> Result<Array>
Materialize a contiguous array according to options.
Allowing column-major layout does not force it and does not guarantee that the result can
be borrowed with Array::try_as_slice.
Sourcepub fn flip(&self, axes: Axes) -> Result<Array>
pub fn flip(&self, axes: Axes) -> Result<Array>
Reverse elements along selected axes.
Axes::All reverses every axis, while an explicitly empty axis list is an identity.
use mlx_rs::{array, Axes};
let output = array!([[1, 2], [3, 4]]).flip(Axes::Axis(-1)).unwrap();
assert_eq!(output.shape(), &[2, 2]);Sourcepub fn unstack(&self, axis: i32) -> Result<Vec<Array>>
pub fn unstack(&self, axis: i32) -> Result<Vec<Array>>
Split an array along axis and squeeze that axis from every output.
A zero-length selected axis returns an empty vector.
use mlx_rs::array;
let parts = array!([[1, 2], [3, 4]]).unstack(0).unwrap();
assert_eq!(parts.len(), 2);
assert_eq!(parts[0].shape(), &[2]);Sourcepub fn expand_dims(&self, axis: i32) -> Result<Array>
pub fn expand_dims(&self, axis: i32) -> Result<Array>
See expand_dims().
Sourcepub fn expand_dims_device(
&self,
axis: i32,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around expand_dims
pub fn expand_dims_device( &self, axis: i32, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around expand_dims
Compatibility shim for expand_dims.
Sourcepub fn expand_dims_axes(&self, axes: &[i32]) -> Result<Array>
pub fn expand_dims_axes(&self, axes: &[i32]) -> Result<Array>
See expand_dims_axes().
Sourcepub fn expand_dims_axes_device(
&self,
axes: &[i32],
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around expand_dims_axes
pub fn expand_dims_axes_device( &self, axes: &[i32], stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around expand_dims_axes
Compatibility shim for expand_dims_axes.
Sourcepub fn flatten(
&self,
start_axis: impl Into<Option<i32>>,
end_axis: impl Into<Option<i32>>,
) -> Result<Array>
pub fn flatten( &self, start_axis: impl Into<Option<i32>>, end_axis: impl Into<Option<i32>>, ) -> Result<Array>
See flatten.
Sourcepub fn flatten_device(
&self,
start_axis: impl Into<Option<i32>>,
end_axis: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around flatten
pub fn flatten_device( &self, start_axis: impl Into<Option<i32>>, end_axis: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around flatten
Compatibility shim for flatten.
Sourcepub fn reshape_device(
&self,
shape: &[i32],
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around reshape
pub fn reshape_device( &self, shape: &[i32], stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around reshape
Compatibility shim for reshape.
Sourcepub fn squeeze_axes(&self, axes: &[i32]) -> Result<Array>
pub fn squeeze_axes(&self, axes: &[i32]) -> Result<Array>
See squeeze_axes().
Sourcepub fn squeeze_axes_device(
&self,
axes: &[i32],
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around squeeze_axes
pub fn squeeze_axes_device( &self, axes: &[i32], stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around squeeze_axes
Compatibility shim for squeeze_axes.
Sourcepub fn squeeze_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around squeeze
pub fn squeeze_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around squeeze
Compatibility shim for squeeze.
Sourcepub fn as_strided<'a>(
&'a self,
shape: impl IntoOption<&'a [i32]>,
strides: impl IntoOption<&'a [i64]>,
offset: impl Into<Option<usize>>,
) -> Result<Array>
pub fn as_strided<'a>( &'a self, shape: impl IntoOption<&'a [i32]>, strides: impl IntoOption<&'a [i64]>, offset: impl Into<Option<usize>>, ) -> Result<Array>
See as_strided
Sourcepub fn as_strided_device<'a>(
&'a self,
shape: impl IntoOption<&'a [i32]>,
strides: impl IntoOption<&'a [i64]>,
offset: impl Into<Option<usize>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around as_strided
pub fn as_strided_device<'a>( &'a self, shape: impl IntoOption<&'a [i32]>, strides: impl IntoOption<&'a [i64]>, offset: impl Into<Option<usize>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around as_strided
Compatibility shim for as_strided.
Sourcepub fn at_least_1d(&self) -> Result<Array>
pub fn at_least_1d(&self) -> Result<Array>
See at_least_1d
Sourcepub fn at_least_1d_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around at_least_1d
pub fn at_least_1d_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around at_least_1d
Compatibility shim for at_least_1d.
Sourcepub fn at_least_2d(&self) -> Result<Array>
pub fn at_least_2d(&self) -> Result<Array>
See at_least_2d
Sourcepub fn at_least_2d_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around at_least_2d
pub fn at_least_2d_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around at_least_2d
Compatibility shim for at_least_2d.
Sourcepub fn at_least_3d(&self) -> Result<Array>
pub fn at_least_3d(&self) -> Result<Array>
See at_least_3d
Sourcepub fn at_least_3d_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around at_least_3d
pub fn at_least_3d_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around at_least_3d
Compatibility shim for at_least_3d.
Sourcepub fn move_axis_device(
&self,
src: i32,
dst: i32,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around move_axis
pub fn move_axis_device( &self, src: i32, dst: i32, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around move_axis
Compatibility shim for move_axis.
Sourcepub fn split_at_indices(
&self,
indices: &[i32],
axis: impl Into<Option<i32>>,
) -> Result<Vec<Array>>
pub fn split_at_indices( &self, indices: &[i32], axis: impl Into<Option<i32>>, ) -> Result<Vec<Array>>
See split_at_indices.
Sourcepub fn split_axis(
&self,
indices: &[i32],
axis: impl Into<Option<i32>>,
) -> Result<Vec<Array>>
👎Deprecated since 0.26.0: renamed to split_at_indices
pub fn split_axis( &self, indices: &[i32], axis: impl Into<Option<i32>>, ) -> Result<Vec<Array>>
renamed to split_at_indices
Compatibility alias for Array::split_at_indices.
Sourcepub fn split_axis_device(
&self,
indices: &[i32],
axis: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Vec<Array>>
👎Deprecated since 0.26.0: use with_stream or with_device around split_at_indices
pub fn split_axis_device( &self, indices: &[i32], axis: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Vec<Array>>
use with_stream or with_device around split_at_indices
Compatibility shim for [split_axis].
Sourcepub fn split_equal(
&self,
num_parts: i32,
axis: impl Into<Option<i32>>,
) -> Result<Vec<Array>>
pub fn split_equal( &self, num_parts: i32, axis: impl Into<Option<i32>>, ) -> Result<Vec<Array>>
See split_equal.
Sourcepub fn split(
&self,
num_parts: i32,
axis: impl Into<Option<i32>>,
) -> Result<Vec<Array>>
👎Deprecated since 0.26.0: renamed to split_equal
pub fn split( &self, num_parts: i32, axis: impl Into<Option<i32>>, ) -> Result<Vec<Array>>
renamed to split_equal
Compatibility alias for Array::split_equal.
Sourcepub fn split_device(
&self,
num_parts: i32,
axis: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Vec<Array>>
👎Deprecated since 0.26.0: use with_stream or with_device around split_equal
pub fn split_device( &self, num_parts: i32, axis: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Vec<Array>>
use with_stream or with_device around split_equal
Compatibility shim for split.
Sourcepub fn swap_axes_device(
&self,
axis1: i32,
axis2: i32,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around swap_axes
pub fn swap_axes_device( &self, axis1: i32, axis2: i32, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around swap_axes
Compatibility shim for swap_axes.
Sourcepub fn transpose_axes(&self, axes: &[i32]) -> Result<Array>
pub fn transpose_axes(&self, axes: &[i32]) -> Result<Array>
See transpose_axes
Sourcepub fn transpose_axes_device(
&self,
axes: &[i32],
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around transpose_axes
pub fn transpose_axes_device( &self, axes: &[i32], stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around transpose_axes
Compatibility shim for transpose_axes.
Sourcepub fn transpose_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around transpose
pub fn transpose_device(&self, stream: impl AsRef<Stream>) -> Result<Array>
use with_stream or with_device around transpose
Compatibility shim for transpose.
Sourcepub fn t(&self) -> Array
pub fn t(&self) -> Array
transpose_axes and unwrap the result.
Source§impl Array
impl Array
Sourcepub fn search_sorted(
&self,
values: impl AsRef<Array>,
side: SearchSide,
) -> Result<Array>
pub fn search_sorted( &self, values: impl AsRef<Array>, side: SearchSide, ) -> Result<Array>
Find insertion indices for values in this one-dimensional sequence.
The result has the values’ shape and u32 dtype. Sortedness is not validated; results for
unsorted sequences are unspecified.
use mlx_rs::{array, ops::SearchSide, Dtype};
let result = array!([1, 2, 2, 3])
.search_sorted(array!([2]), SearchSide::Right)
.unwrap();
assert_eq!(result.dtype(), Dtype::Uint32);Source§impl Array
impl Array
Sourcepub fn take_axis(&self, indices: impl AsRef<Array>, axis: i32) -> Result<Array>
pub fn take_axis(&self, indices: impl AsRef<Array>, axis: i32) -> Result<Array>
Take elements along an axis.
The elements are taken from indices along the specified axis. If the axis is not specified
the array is treated as a flattened 1-D array prior to performing the take.
See [Array::take_all] for the flattened array.
§Params
indices: The indices to take from the array.axis: The axis along which to take the elements.
Sourcepub fn take_axis_device(
&self,
indices: impl AsRef<Array>,
axis: i32,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around take_axis
pub fn take_axis_device( &self, indices: impl AsRef<Array>, axis: i32, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around take_axis
Compatibility shim for take_axis.
Sourcepub fn take_device(
&self,
indices: impl AsRef<Array>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around take
pub fn take_device( &self, indices: impl AsRef<Array>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around take
Compatibility shim for take.
Sourcepub fn take_along_axis(
&self,
indices: impl AsRef<Array>,
axis: impl Into<Option<i32>>,
) -> Result<Array>
pub fn take_along_axis( &self, indices: impl AsRef<Array>, axis: impl Into<Option<i32>>, ) -> Result<Array>
Take values along an axis at the specified indices.
If no axis is specified, the array is flattened to 1D prior to the indexing operation.
§Params
indices: The indices to take from the array.axis: Axis in the input to take the values from.
Sourcepub fn take_along_axis_device(
&self,
indices: impl AsRef<Array>,
axis: impl Into<Option<i32>>,
stream: impl AsRef<Stream>,
) -> Result<Array>
👎Deprecated since 0.26.0: use with_stream or with_device around take_along_axis
pub fn take_along_axis_device( &self, indices: impl AsRef<Array>, axis: impl Into<Option<i32>>, stream: impl AsRef<Stream>, ) -> Result<Array>
use with_stream or with_device around take_along_axis
Compatibility shim for take_along_axis.
Sourcepub fn put_along_axis(
&self,
indices: impl AsRef<Array>,
values: impl AsRef<Array>,
axis: impl Into<Option<i32>>,
) -> Result<Array>
pub fn put_along_axis( &self, indices: impl AsRef<Array>, values: impl AsRef<Array>, axis: impl Into<Option<i32>>, ) -> Result<Array>
Put values along an axis at the specified indices.
If no axis is specified, the array is flattened to 1D prior to the indexing operation.
§Params
- indices: Indices array. These should be broadcastable with the input array excluding the
axisdimension. - values: Values array. These should be broadcastable with the indices.
- axis: Axis in the destination to put the values to.
- stream: stream or device to evaluate on.
Trait Implementations§
Source§impl<'a, T> Add<T> for Arraywhere
T: ScalarOrArray<'a>,
impl<'a, T> Add<T> for Arraywhere
T: ScalarOrArray<'a>,
Source§impl<'a, 't: 'a, T> Add<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
impl<'a, 't: 'a, T> Add<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
Source§impl AddAssign<&Array> for Array
impl AddAssign<&Array> for Array
Source§fn add_assign(&mut self, rhs: &Self)
fn add_assign(&mut self, rhs: &Self)
+= operation. Read moreSource§impl<T: Into<Array>> AddAssign<T> for Array
impl<T: Into<Array>> AddAssign<T> for Array
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+= operation. Read moreSource§impl<'a> ArrayIndex<'a> for Array
impl<'a> ArrayIndex<'a> for Array
Source§fn index_op(self) -> ArrayIndexOp<'a>
fn index_op(self) -> ArrayIndexOp<'a>
mlx allows out of bounds indexing.Source§impl<'a> ArrayIndex<'a> for &'a Array
impl<'a> ArrayIndex<'a> for &'a Array
Source§fn index_op(self) -> ArrayIndexOp<'a>
fn index_op(self) -> ArrayIndexOp<'a>
mlx allows out of bounds indexing.Source§impl<'a, F, G> CallMut<(&'a Array, &'a Array, &'a Array), Array, Exception> for Compiled<F, G>
impl<'a, F, G> CallMut<(&'a Array, &'a Array, &'a Array), Array, Exception> for Compiled<F, G>
Source§impl<U, F, G> CallMutWithState<U, (&Array, &Array, &Array), Array, Exception> for Compiled<F, G>
impl<U, F, G> CallMutWithState<U, (&Array, &Array, &Array), Array, Exception> for Compiled<F, G>
Source§impl<'a, T> Div<T> for Arraywhere
T: ScalarOrArray<'a>,
impl<'a, T> Div<T> for Arraywhere
T: ScalarOrArray<'a>,
Source§impl<'a, 't: 'a, T> Div<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
impl<'a, 't: 'a, T> Div<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
Source§impl DivAssign<&Array> for Array
impl DivAssign<&Array> for Array
Source§fn div_assign(&mut self, rhs: &Self)
fn div_assign(&mut self, rhs: &Self)
/= operation. Read moreSource§impl<T: Into<Array>> DivAssign<T> for Array
impl<T: Into<Array>> DivAssign<T> for Array
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/= operation. Read moreSource§impl<'a> From<&'a Array> for ScaledDotProductAttentionMask<'a>
impl<'a> From<&'a Array> for ScaledDotProductAttentionMask<'a>
Source§impl<'a> From<&'a Array> for AlibiInput<'a>
impl<'a> From<&'a Array> for AlibiInput<'a>
Source§impl From<&Array> for GgufMetadataValue
impl From<&Array> for GgufMetadataValue
Source§impl From<Array> for GgufMetadataValue
impl From<Array> for GgufMetadataValue
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<&[&[&[T; N]; M]; O]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<&[&[&[T; N]; M]; O]> for Array
Source§impl<T: FromSliceElement + Copy> FromNested<&[&[&[T]]]> for Array
impl<T: FromSliceElement + Copy> FromNested<&[&[&[T]]]> for Array
Source§fn from_nested(data: &[&[&[T]]]) -> Self
fn from_nested(data: &[&[&[T]]]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<&[&[T; N]; M]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<&[&[T; N]; M]> for Array
Source§fn from_nested(data: &[&[T; N]; M]) -> Self
fn from_nested(data: &[&[T; N]; M]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize> FromNested<&[&[T; N]]> for Array
impl<T: FromSliceElement + Copy, const N: usize> FromNested<&[&[T; N]]> for Array
Source§fn from_nested(data: &[&[T; N]]) -> Self
fn from_nested(data: &[&[T; N]]) -> Self
Source§impl<T: FromSliceElement + Copy> FromNested<&[&[T]]> for Array
impl<T: FromSliceElement + Copy> FromNested<&[&[T]]> for Array
Source§fn from_nested(data: &[&[T]]) -> Self
fn from_nested(data: &[&[T]]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<&[&[[T; N]; M]; O]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<&[&[[T; N]; M]; O]> for Array
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<&[&[[T; N]]; M]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<&[&[[T; N]]; M]> for Array
Source§fn from_nested(data: &[&[[T; N]]; M]) -> Self
fn from_nested(data: &[&[[T; N]]; M]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize> FromNested<&[&[[T; N]]]> for Array
impl<T: FromSliceElement + Copy, const N: usize> FromNested<&[&[[T; N]]]> for Array
Source§fn from_nested(data: &[&[[T; N]]]) -> Self
fn from_nested(data: &[&[[T; N]]]) -> Self
Source§impl<T: FromSliceElement, const N: usize> FromNested<&[T; N]> for Array
impl<T: FromSliceElement, const N: usize> FromNested<&[T; N]> for Array
Source§fn from_nested(data: &[T; N]) -> Self
fn from_nested(data: &[T; N]) -> Self
Source§impl<T: FromSliceElement> FromNested<&[T]> for Array
impl<T: FromSliceElement> FromNested<&[T]> for Array
Source§fn from_nested(data: &[T]) -> Self
fn from_nested(data: &[T]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<&[[&[T; N]; M]; O]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<&[[&[T; N]; M]; O]> for Array
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<&[[&[T]; N]; M]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<&[[&[T]; N]; M]> for Array
Source§impl<T: FromSliceElement + Copy, const N: usize> FromNested<&[[&[T]; N]]> for Array
impl<T: FromSliceElement + Copy, const N: usize> FromNested<&[[&[T]; N]]> for Array
Source§fn from_nested(data: &[[&[T]; N]]) -> Self
fn from_nested(data: &[[&[T]; N]]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<&[[T; N]; M]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<&[[T; N]; M]> for Array
Source§fn from_nested(data: &[[T; N]; M]) -> Self
fn from_nested(data: &[[T; N]; M]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize> FromNested<&[[T; N]]> for Array
impl<T: FromSliceElement + Copy, const N: usize> FromNested<&[[T; N]]> for Array
Source§fn from_nested(data: &[[T; N]]) -> Self
fn from_nested(data: &[[T; N]]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<&[[[T; N]; M]; O]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<&[[[T; N]; M]; O]> for Array
Source§impl<T: FromSliceElement + Copy, const N: usize> FromNested<[&[&[T]]; N]> for Array
impl<T: FromSliceElement + Copy, const N: usize> FromNested<[&[&[T]]; N]> for Array
Source§fn from_nested(data: [&[&[T]]; N]) -> Self
fn from_nested(data: [&[&[T]]; N]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize> FromNested<[&[T]; N]> for Array
impl<T: FromSliceElement + Copy, const N: usize> FromNested<[&[T]; N]> for Array
Source§fn from_nested(data: [&[T]; N]) -> Self
fn from_nested(data: [&[T]; N]) -> Self
Source§impl<T: FromSliceElement, const N: usize> FromNested<[T; N]> for Array
impl<T: FromSliceElement, const N: usize> FromNested<[T; N]> for Array
Source§fn from_nested(data: [T; N]) -> Self
fn from_nested(data: [T; N]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<[[&[T]; N]; M]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<[[&[T]; N]; M]> for Array
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<[[T; N]; M]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize> FromNested<[[T; N]; M]> for Array
Source§fn from_nested(data: [[T; N]; M]) -> Self
fn from_nested(data: [[T; N]; M]) -> Self
Source§impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<[[[T; N]; M]; O]> for Array
impl<T: FromSliceElement + Copy, const N: usize, const M: usize, const O: usize> FromNested<[[[T; N]; M]; O]> for Array
Source§impl FromScalar<Complex<f32>> for Array
impl FromScalar<Complex<f32>> for Array
Source§fn from_scalar(val: complex64) -> Array
fn from_scalar(val: complex64) -> Array
Source§impl FromScalar<bool> for Array
impl FromScalar<bool> for Array
Source§fn from_scalar(val: bool) -> Array
fn from_scalar(val: bool) -> Array
Source§impl FromScalar<f32> for Array
impl FromScalar<f32> for Array
Source§fn from_scalar(val: f32) -> Array
fn from_scalar(val: f32) -> Array
Source§impl FromScalar<i32> for Array
impl FromScalar<i32> for Array
Source§fn from_scalar(val: i32) -> Array
fn from_scalar(val: i32) -> Array
Source§impl<'a, F, M, Args> IntoModuleValueAndGrad<'a, M, Args, Array, ()> for F
impl<'a, F, M, Args> IntoModuleValueAndGrad<'a, M, Args, Array, ()> for F
Source§fn into_module_value_and_grad(
self,
) -> impl FnMut(&mut M, Args) -> Result<(Array, FlattenedModuleParam), Exception> + 'a
fn into_module_value_and_grad( self, ) -> impl FnMut(&mut M, Args) -> Result<(Array, FlattenedModuleParam), Exception> + 'a
f(model, args) with regard to the
model’s trainable parameters.Source§impl<'a, F, M, Args> IntoModuleValueAndGrad<'a, M, Args, Array, Exception> for F
impl<'a, F, M, Args> IntoModuleValueAndGrad<'a, M, Args, Array, Exception> for F
Source§fn into_module_value_and_grad(
self,
) -> impl FnMut(&mut M, Args) -> Result<(Array, FlattenedModuleParam), Exception> + 'a
fn into_module_value_and_grad( self, ) -> impl FnMut(&mut M, Args) -> Result<(Array, FlattenedModuleParam), Exception> + 'a
f(model, args) with regard to the
model’s trainable parameters.Source§impl<'a> IntoOption<ScaledDotProductAttentionMask<'a>> for &'a Array
impl<'a> IntoOption<ScaledDotProductAttentionMask<'a>> for &'a Array
Source§fn into_option(self) -> Option<ScaledDotProductAttentionMask<'a>>
fn into_option(self) -> Option<ScaledDotProductAttentionMask<'a>>
Option.Source§impl Module<&Array> for LogSoftmax
impl Module<&Array> for LogSoftmax
Source§impl Module<&Array> for LogSigmoid
impl Module<&Array> for LogSigmoid
Source§impl Module<&Array> for Sequential
impl Module<&Array> for Sequential
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for ConvTranspose1d
impl Module<&Array> for ConvTranspose1d
Source§impl Module<&Array> for ConvTranspose2d
impl Module<&Array> for ConvTranspose2d
Source§impl Module<&Array> for ConvTranspose3d
impl Module<&Array> for ConvTranspose3d
Source§impl Module<&Array> for Dropout
impl Module<&Array> for Dropout
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for Dropout2d
impl Module<&Array> for Dropout2d
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for Dropout3d
impl Module<&Array> for Dropout3d
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for Embedding
impl Module<&Array> for Embedding
Source§fn training_mode(&mut self, _mode: bool)
fn training_mode(&mut self, _mode: bool)
Source§impl Module<&Array> for InstanceNorm
impl Module<&Array> for InstanceNorm
Source§fn training_mode(&mut self, _mode: bool)
fn training_mode(&mut self, _mode: bool)
Source§impl Module<&Array> for LayerNorm
impl Module<&Array> for LayerNorm
Source§fn training_mode(&mut self, _mode: bool)
fn training_mode(&mut self, _mode: bool)
Source§impl Module<&Array> for RmsNorm
impl Module<&Array> for RmsNorm
Source§fn training_mode(&mut self, _mode: bool)
fn training_mode(&mut self, _mode: bool)
Source§impl Module<&Array> for GroupNorm
impl Module<&Array> for GroupNorm
Source§fn training_mode(&mut self, _mode: bool)
fn training_mode(&mut self, _mode: bool)
Source§impl Module<&Array> for BatchNorm
impl Module<&Array> for BatchNorm
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for Pool
impl Module<&Array> for Pool
Source§fn training_mode(&mut self, _mode: bool)
fn training_mode(&mut self, _mode: bool)
Source§impl Module<&Array> for MaxPool1d
impl Module<&Array> for MaxPool1d
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for MaxPool2d
impl Module<&Array> for MaxPool2d
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for AvgPool1d
impl Module<&Array> for AvgPool1d
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for AvgPool2d
impl Module<&Array> for AvgPool2d
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for Sinpe
impl Module<&Array> for Sinpe
Source§impl Module<&Array> for QuantizedEmbedding
impl Module<&Array> for QuantizedEmbedding
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for QuantizedLinear
impl Module<&Array> for QuantizedLinear
Source§fn training_mode(&mut self, mode: bool)
fn training_mode(&mut self, mode: bool)
Source§impl Module<&Array> for Upsample
impl Module<&Array> for Upsample
Source§impl<'a, T> Mul<T> for Arraywhere
T: ScalarOrArray<'a>,
impl<'a, T> Mul<T> for Arraywhere
T: ScalarOrArray<'a>,
Source§impl<'a, 't: 'a, T> Mul<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
impl<'a, 't: 'a, T> Mul<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
Source§impl MulAssign<&Array> for Array
impl MulAssign<&Array> for Array
Source§fn mul_assign(&mut self, rhs: &Self)
fn mul_assign(&mut self, rhs: &Self)
*= operation. Read moreSource§impl<T: Into<Array>> MulAssign<T> for Array
impl<T: Into<Array>> MulAssign<T> for Array
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moreSource§impl<'a, T> Pow<T> for Arraywhere
T: ScalarOrArray<'a>,
impl<'a, T> Pow<T> for Arraywhere
T: ScalarOrArray<'a>,
Source§impl<'a, 't: 'a, T> Pow<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
impl<'a, 't: 'a, T> Pow<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
Source§impl<'a, T> Rem<T> for Arraywhere
T: ScalarOrArray<'a>,
impl<'a, T> Rem<T> for Arraywhere
T: ScalarOrArray<'a>,
Source§impl<'a, 't: 'a, T> Rem<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
impl<'a, 't: 'a, T> Rem<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
Source§impl RemAssign<&Array> for Array
impl RemAssign<&Array> for Array
Source§fn rem_assign(&mut self, rhs: &Self)
fn rem_assign(&mut self, rhs: &Self)
%= operation. Read moreSource§impl<T: Into<Array>> RemAssign<T> for Array
impl<T: Into<Array>> RemAssign<T> for Array
Source§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
%= operation. Read moreSource§impl ScalarOrArray<'_> for Array
impl ScalarOrArray<'_> for Array
Source§impl<'a> ScalarOrArray<'a> for &'a Array
impl<'a> ScalarOrArray<'a> for &'a Array
impl Send for Array
Source§impl<'a, T> Sub<T> for Arraywhere
T: ScalarOrArray<'a>,
impl<'a, T> Sub<T> for Arraywhere
T: ScalarOrArray<'a>,
Source§impl<'a, 't: 'a, T> Sub<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
impl<'a, 't: 'a, T> Sub<T> for &'a Arraywhere
T: ScalarOrArray<'t>,
Source§impl SubAssign<&Array> for Array
impl SubAssign<&Array> for Array
Source§fn sub_assign(&mut self, rhs: &Self)
fn sub_assign(&mut self, rhs: &Self)
-= operation. Read moreSource§impl<T: Into<Array>> SubAssign<T> for Array
impl<T: Into<Array>> SubAssign<T> for Array
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-= operation. Read moreSource§impl<'a, Val> TryIndexMutOp<&'a [ArrayIndexOp<'a>], Val> for Array
impl<'a, Val> TryIndexMutOp<&'a [ArrayIndexOp<'a>], Val> for Array
Source§fn try_index_mut_device(
&mut self,
i: &'a [ArrayIndexOp<'a>],
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: &'a [ArrayIndexOp<'a>], val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, A, B, Val> TryIndexMutOp<(A, B), Val> for Array
impl<'a, 'b, A, B, Val> TryIndexMutOp<(A, B), Val> for Array
Source§impl<'a, 'b, 'c, A, B, C, Val> TryIndexMutOp<(A, B, C), Val> for Array
impl<'a, 'b, 'c, A, B, C, Val> TryIndexMutOp<(A, B, C), Val> for Array
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, A, B, C, D, Val> TryIndexMutOp<(A, B, C, D), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, A, B, C, D, Val> TryIndexMutOp<(A, B, C, D), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, A, B, C, D, E, Val> TryIndexMutOp<(A, B, C, D, E), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, A, B, C, D, E, Val> TryIndexMutOp<(A, B, C, D, E), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, A, B, C, D, E, F, Val> TryIndexMutOp<(A, B, C, D, E, F), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, A, B, C, D, E, F, Val> TryIndexMutOp<(A, B, C, D, E, F), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, A, B, C, D, E, F, G, Val> TryIndexMutOp<(A, B, C, D, E, F, G), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, A, B, C, D, E, F, G, Val> TryIndexMutOp<(A, B, C, D, E, F, G), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, A, B, C, D, E, F, G, H, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, A, B, C, D, E, F, G, H, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G, H),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G, H), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, A, B, C, D, E, F, G, H, I, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, A, B, C, D, E, F, G, H, I, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G, H, I),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G, H, I), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, A, B, C, D, E, F, G, H, I, J, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, A, B, C, D, E, F, G, H, I, J, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G, H, I, J),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G, H, I, J), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, A, B, C, D, E, F, G, H, I, J, K, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, A, B, C, D, E, F, G, H, I, J, K, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G, H, I, J, K),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G, H, I, J, K), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, A, B, C, D, E, F, G, H, I, J, K, L, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, A, B, C, D, E, F, G, H, I, J, K, L, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G, H, I, J, K, L),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G, H, I, J, K, L), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, A, B, C, D, E, F, G, H, I, J, K, L, M, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L, M), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, A, B, C, D, E, F, G, H, I, J, K, L, M, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L, M), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G, H, I, J, K, L, M),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G, H, I, J, K, L, M), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, A, B, C, D, E, F, G, H, I, J, K, L, M, N, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, A, B, C, D, E, F, G, H, I, J, K, L, M, N, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G, H, I, J, K, L, M, N),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G, H, I, J, K, L, M, N), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
P: ArrayIndex<'p>,
Val: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Val> TryIndexMutOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), Val> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
P: ArrayIndex<'p>,
Val: AsRef<Array>,
Source§fn try_index_mut_device(
&mut self,
i: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P),
val: Val,
stream: impl AsRef<Stream>,
) -> Result<()>
fn try_index_mut_device( &mut self, i: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), val: Val, stream: impl AsRef<Stream>, ) -> Result<()>
Source§fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
fn try_index_mut(&mut self, i: Idx, val: Val) -> Result<()>
Source§impl<'a, A, Val> TryIndexMutOp<(A,), Val> for Array
impl<'a, A, Val> TryIndexMutOp<(A,), Val> for Array
Source§impl<A, Val> TryIndexMutOp<A, Val> for Array
impl<A, Val> TryIndexMutOp<A, Val> for Array
Source§impl<'a> TryIndexOp<&'a [ArrayIndexOp<'a>]> for Array
impl<'a> TryIndexOp<&'a [ArrayIndexOp<'a>]> for Array
Source§impl<'a, 'b, A, B> TryIndexOp<(A, B)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
impl<'a, 'b, A, B> TryIndexOp<(A, B)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
Source§impl<'a, 'b, 'c, A, B, C> TryIndexOp<(A, B, C)> for Array
impl<'a, 'b, 'c, A, B, C> TryIndexOp<(A, B, C)> for Array
Source§impl<'a, 'b, 'c, 'd, A, B, C, D> TryIndexOp<(A, B, C, D)> for Array
impl<'a, 'b, 'c, 'd, A, B, C, D> TryIndexOp<(A, B, C, D)> for Array
Source§impl<'a, 'b, 'c, 'd, 'e, A, B, C, D, E> TryIndexOp<(A, B, C, D, E)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
impl<'a, 'b, 'c, 'd, 'e, A, B, C, D, E> TryIndexOp<(A, B, C, D, E)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, A, B, C, D, E, F> TryIndexOp<(A, B, C, D, E, F)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
impl<'a, 'b, 'c, 'd, 'e, 'f, A, B, C, D, E, F> TryIndexOp<(A, B, C, D, E, F)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, A, B, C, D, E, F, G> TryIndexOp<(A, B, C, D, E, F, G)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, A, B, C, D, E, F, G> TryIndexOp<(A, B, C, D, E, F, G)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, A, B, C, D, E, F, G, H> TryIndexOp<(A, B, C, D, E, F, G, H)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, A, B, C, D, E, F, G, H> TryIndexOp<(A, B, C, D, E, F, G, H)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, A, B, C, D, E, F, G, H, I> TryIndexOp<(A, B, C, D, E, F, G, H, I)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, A, B, C, D, E, F, G, H, I> TryIndexOp<(A, B, C, D, E, F, G, H, I)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, A, B, C, D, E, F, G, H, I, J> TryIndexOp<(A, B, C, D, E, F, G, H, I, J)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, A, B, C, D, E, F, G, H, I, J> TryIndexOp<(A, B, C, D, E, F, G, H, I, J)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, A, B, C, D, E, F, G, H, I, J, K> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, A, B, C, D, E, F, G, H, I, J, K> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, A, B, C, D, E, F, G, H, I, J, K, L> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, A, B, C, D, E, F, G, H, I, J, K, L> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, A, B, C, D, E, F, G, H, I, J, K, L, M> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L, M)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, A, B, C, D, E, F, G, H, I, J, K, L, M> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L, M)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, A, B, C, D, E, F, G, H, I, J, K, L, M, N> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, A, B, C, D, E, F, G, H, I, J, K, L, M, N> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
P: ArrayIndex<'p>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> TryIndexOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
P: ArrayIndex<'p>,
Source§impl<'a, A> TryIndexOp<(A,)> for Arraywhere
A: ArrayIndex<'a>,
impl<'a, A> TryIndexOp<(A,)> for Arraywhere
A: ArrayIndex<'a>,
Source§impl<'a, T> TryIndexOp<T> for Arraywhere
T: ArrayIndex<'a>,
impl<'a, T> TryIndexOp<T> for Arraywhere
T: ArrayIndex<'a>,
Source§impl<'a, Value> TryIndexUpdateOp<&'a [ArrayIndexOp<'a>], Value> for Array
impl<'a, Value> TryIndexUpdateOp<&'a [ArrayIndexOp<'a>], Value> for Array
Source§fn try_index_update(
&self,
index: &'a [ArrayIndexOp<'a>],
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: &'a [ArrayIndexOp<'a>], update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, A, B, Value> TryIndexUpdateOp<(A, B), Value> for Array
impl<'a, 'b, A, B, Value> TryIndexUpdateOp<(A, B), Value> for Array
Source§fn try_index_update(
&self,
index: (A, B),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, A, B, C, Value> TryIndexUpdateOp<(A, B, C), Value> for Array
impl<'a, 'b, 'c, A, B, C, Value> TryIndexUpdateOp<(A, B, C), Value> for Array
Source§fn try_index_update(
&self,
index: (A, B, C),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, A, B, C, D, Value> TryIndexUpdateOp<(A, B, C, D), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, A, B, C, D, Value> TryIndexUpdateOp<(A, B, C, D), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, A, B, C, D, E, Value> TryIndexUpdateOp<(A, B, C, D, E), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, A, B, C, D, E, Value> TryIndexUpdateOp<(A, B, C, D, E), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, A, B, C, D, E, F, Value> TryIndexUpdateOp<(A, B, C, D, E, F), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, A, B, C, D, E, F, Value> TryIndexUpdateOp<(A, B, C, D, E, F), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, A, B, C, D, E, F, G, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, A, B, C, D, E, F, G, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, A, B, C, D, E, F, G, H, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, A, B, C, D, E, F, G, H, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G, H),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G, H), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, A, B, C, D, E, F, G, H, I, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, A, B, C, D, E, F, G, H, I, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G, H, I),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G, H, I), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, A, B, C, D, E, F, G, H, I, J, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, A, B, C, D, E, F, G, H, I, J, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G, H, I, J),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G, H, I, J), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, A, B, C, D, E, F, G, H, I, J, K, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, A, B, C, D, E, F, G, H, I, J, K, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G, H, I, J, K),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G, H, I, J, K), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, A, B, C, D, E, F, G, H, I, J, K, L, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, A, B, C, D, E, F, G, H, I, J, K, L, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G, H, I, J, K, L),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G, H, I, J, K, L), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, A, B, C, D, E, F, G, H, I, J, K, L, M, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L, M), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, A, B, C, D, E, F, G, H, I, J, K, L, M, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L, M), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G, H, I, J, K, L, M),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G, H, I, J, K, L, M), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, A, B, C, D, E, F, G, H, I, J, K, L, M, N, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, A, B, C, D, E, F, G, H, I, J, K, L, M, N, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G, H, I, J, K, L, M, N),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G, H, I, J, K, L, M, N), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
P: ArrayIndex<'p>,
Value: AsRef<Array>,
impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Value> TryIndexUpdateOp<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), Value> for Arraywhere
A: ArrayIndex<'a>,
B: ArrayIndex<'b>,
C: ArrayIndex<'c>,
D: ArrayIndex<'d>,
E: ArrayIndex<'e>,
F: ArrayIndex<'f>,
G: ArrayIndex<'g>,
H: ArrayIndex<'h>,
I: ArrayIndex<'i>,
J: ArrayIndex<'j>,
K: ArrayIndex<'k>,
L: ArrayIndex<'l>,
M: ArrayIndex<'m>,
N: ArrayIndex<'n>,
O: ArrayIndex<'o>,
P: ArrayIndex<'p>,
Value: AsRef<Array>,
Source§fn try_index_update(
&self,
index: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, A, Value> TryIndexUpdateOp<(A,), Value> for Array
impl<'a, A, Value> TryIndexUpdateOp<(A,), Value> for Array
Source§fn try_index_update(
&self,
index: (A,),
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: (A,), update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Source§impl<'a, Index, Value> TryIndexUpdateOp<Index, Value> for Array
impl<'a, Index, Value> TryIndexUpdateOp<Index, Value> for Array
Source§fn try_index_update(
&self,
index: Index,
update: Value,
mode: UpdateMode,
) -> Result<Array, IndexUpdateError>
fn try_index_update( &self, index: Index, update: Value, mode: UpdateMode, ) -> Result<Array, IndexUpdateError>
update applied at index according to mode.Auto Trait Implementations§
impl !Sync for Array
impl Freeze for Array
impl RefUnwindSafe for Array
impl Unpin for Array
impl UnsafeUnpin for Array
impl UnwindSafe for Array
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, Idx, Val> IndexMutOp<Idx, Val> for Twhere
T: TryIndexMutOp<Idx, Val>,
impl<T, Idx, Val> IndexMutOp<Idx, Val> for Twhere
T: TryIndexMutOp<Idx, Val>,
Source§impl<T, Idx> IndexOp<Idx> for Twhere
T: TryIndexOp<Idx>,
impl<T, Idx> IndexOp<Idx> for Twhere
T: TryIndexOp<Idx>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Option.