pub struct DeviceSettings {
pub float_dtype: FloatDType,
pub int_dtype: IntDType,
pub bool_dtype: BoolStore,
pub quantization: QuantConfig,
}Expand description
Settings controlling the default data types for a specific device.
These settings are managed in a global registry that enforces strict initialization semantics:
- Manual Initialization: You can set these once at the start of your program using
set_default_dtypes. - Default Initialization: If an operation (like creating a tensor) occurs before manual initialization, the settings are permanently locked to their default values.
- Immutability: Once initialized, settings cannot be changed. This ensures consistent behavior across all threads and operations.
Fields§
§float_dtype: FloatDTypeDefault floating-point data type.
int_dtype: IntDTypeDefault integer data type.
bool_dtype: BoolStoreDefault bool data type.
quantization: QuantConfigQuantization configuration.
Implementations§
Source§impl DeviceSettings
impl DeviceSettings
Sourcepub fn new(
float_dtype: impl Into<FloatDType>,
int_dtype: impl Into<IntDType>,
bool_dtype: impl Into<BoolStore>,
quantization: QuantConfig,
) -> DeviceSettings
pub fn new( float_dtype: impl Into<FloatDType>, int_dtype: impl Into<IntDType>, bool_dtype: impl Into<BoolStore>, quantization: QuantConfig, ) -> DeviceSettings
Creates a new DeviceSettings from any types convertible into the dtype kinds and the quantization config.
Sourcepub fn with_dtypes(
float_dtype: impl Into<FloatDType>,
int_dtype: impl Into<IntDType>,
bool_dtype: impl Into<BoolStore>,
) -> DeviceSettings
pub fn with_dtypes( float_dtype: impl Into<FloatDType>, int_dtype: impl Into<IntDType>, bool_dtype: impl Into<BoolStore>, ) -> DeviceSettings
Creates a new DeviceSettings from any types convertible into the dtype kinds.
Trait Implementations§
Source§impl Clone for DeviceSettings
impl Clone for DeviceSettings
Source§fn clone(&self) -> DeviceSettings
fn clone(&self) -> DeviceSettings
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for DeviceSettings
Source§impl Debug for DeviceSettings
impl Debug for DeviceSettings
Source§impl<'de> Deserialize<'de> for DeviceSettings
impl<'de> Deserialize<'de> for DeviceSettings
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DeviceSettings, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DeviceSettings, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DeviceSettings
Source§impl PartialEq for DeviceSettings
impl PartialEq for DeviceSettings
Source§impl Serialize for DeviceSettings
impl Serialize for DeviceSettings
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DeviceSettings
Auto Trait Implementations§
impl Freeze for DeviceSettings
impl RefUnwindSafe for DeviceSettings
impl Send for DeviceSettings
impl Sync for DeviceSettings
impl Unpin for DeviceSettings
impl UnsafeUnpin for DeviceSettings
impl UnwindSafe for DeviceSettings
Blanket Implementations§
impl<T> Boilerplate for T
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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