pub struct QuantizationSchemeStorage {
pub config_path: Option<PathBuf>,
pub config: QuantizationSchemeConfig,
pub scheme_cache: HashMap<String, QuantizationScheme>,
}Expand description
Quantization scheme storage manager
Fields§
§config_path: Option<PathBuf>Configuration file path
config: QuantizationSchemeConfigIn-memory configuration
scheme_cache: HashMap<String, QuantizationScheme>Cache for recently determined schemes
Implementations§
Source§impl QuantizationSchemeStorage
impl QuantizationSchemeStorage
Sourcepub fn with_config_file<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn with_config_file<P: AsRef<Path>>(path: P) -> Result<Self>
Create storage manager with config file
Sourcepub fn load_config<P: AsRef<Path>>(path: P) -> Result<QuantizationSchemeConfig>
pub fn load_config<P: AsRef<Path>>(path: P) -> Result<QuantizationSchemeConfig>
Load configuration from file
Sourcepub fn save_config(&self) -> Result<()>
pub fn save_config(&self) -> Result<()>
Save configuration to file
Sourcepub fn determine_scheme(
&mut self,
tensor_id: &str,
layer_name: Option<&str>,
model_name: Option<&str>,
) -> QuantizationScheme
pub fn determine_scheme( &mut self, tensor_id: &str, layer_name: Option<&str>, model_name: Option<&str>, ) -> QuantizationScheme
Determine quantization scheme for a tensor
Sourcepub fn set_tensor_scheme(
&mut self,
tensor_id: String,
scheme: QuantizationScheme,
)
pub fn set_tensor_scheme( &mut self, tensor_id: String, scheme: QuantizationScheme, )
Set scheme for specific tensor
Sourcepub fn set_layer_scheme(
&mut self,
layer_name: String,
scheme: QuantizationScheme,
)
pub fn set_layer_scheme( &mut self, layer_name: String, scheme: QuantizationScheme, )
Set scheme for specific layer
Sourcepub fn set_model_scheme(
&mut self,
model_name: String,
scheme: QuantizationScheme,
)
pub fn set_model_scheme( &mut self, model_name: String, scheme: QuantizationScheme, )
Set scheme for specific model
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear cache
Trait Implementations§
Source§impl Clone for QuantizationSchemeStorage
impl Clone for QuantizationSchemeStorage
Source§impl Debug for QuantizationSchemeStorage
impl Debug for QuantizationSchemeStorage
Auto Trait Implementations§
impl Freeze for QuantizationSchemeStorage
impl RefUnwindSafe for QuantizationSchemeStorage
impl Send for QuantizationSchemeStorage
impl Sync for QuantizationSchemeStorage
impl Unpin for QuantizationSchemeStorage
impl UnsafeUnpin for QuantizationSchemeStorage
impl UnwindSafe for QuantizationSchemeStorage
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
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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