pub struct StreamOrDevice { /* private fields */ }
Expand description
Parameter type for all MLX operations.
Use this to control where operations are evaluated:
If omitted it will use the Default::default(), which will be Device::gpu() unless set otherwise.
Implementations§
Source§impl StreamOrDevice
impl StreamOrDevice
Sourcepub fn new(stream: Stream) -> StreamOrDevice
pub fn new(stream: Stream) -> StreamOrDevice
Create a new StreamOrDevice
with a Stream
.
Sourcepub fn new_with_device(device: &Device) -> StreamOrDevice
pub fn new_with_device(device: &Device) -> StreamOrDevice
Create a new StreamOrDevice
with a Device
.
Sourcepub fn cpu() -> StreamOrDevice
pub fn cpu() -> StreamOrDevice
Current default CPU stream.
Sourcepub fn gpu() -> StreamOrDevice
pub fn gpu() -> StreamOrDevice
Current default GPU stream.
Trait Implementations§
Source§impl AsRef<Stream> for StreamOrDevice
impl AsRef<Stream> for StreamOrDevice
Source§impl Debug for StreamOrDevice
impl Debug for StreamOrDevice
Source§impl Default for StreamOrDevice
impl Default for StreamOrDevice
Source§fn default() -> Self
fn default() -> Self
The default stream on the default device.
This will be Device::gpu() unless Device::set_default() sets it otherwise.
Source§impl Display for StreamOrDevice
impl Display for StreamOrDevice
Source§impl PartialEq for StreamOrDevice
impl PartialEq for StreamOrDevice
impl StructuralPartialEq for StreamOrDevice
Auto Trait Implementations§
impl Freeze for StreamOrDevice
impl RefUnwindSafe for StreamOrDevice
impl !Send for StreamOrDevice
impl !Sync for StreamOrDevice
impl Unpin for StreamOrDevice
impl UnwindSafe for StreamOrDevice
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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>
Convert into an
Option
.