pub struct Context { /* private fields */ }Expand description
Execution context for TenfloweRS operations
Implementations§
Source§impl Context
impl Context
Sourcepub fn with_device(device: Device) -> Result<Self>
pub fn with_device(device: Device) -> Result<Self>
Create a context with specific device
Sourcepub fn default_device(&self) -> Device
pub fn default_device(&self) -> Device
Get the default device
Sourcepub fn set_default_device(&mut self, device: Device)
pub fn set_default_device(&mut self, device: Device)
Set the default device
Sourcepub fn set_eager_mode(&mut self, eager: bool)
pub fn set_eager_mode(&mut self, eager: bool)
Set eager execution mode
Sourcepub fn set_profiling(&mut self, enabled: bool)
pub fn set_profiling(&mut self, enabled: bool)
Enable/disable profiling
Sourcepub fn get_device_context(
&self,
device: &Device,
) -> Result<Arc<dyn DeviceContext>>
pub fn get_device_context( &self, device: &Device, ) -> Result<Arc<dyn DeviceContext>>
Get device context
Sourcepub fn set_attribute(&self, key: String, value: String)
pub fn set_attribute(&self, key: String, value: String)
Set a context attribute
Sourcepub fn get_attribute(&self, key: &str) -> Option<String>
pub fn get_attribute(&self, key: &str) -> Option<String>
Get a context attribute
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more