pub struct ModelValidator { /* private fields */ }Expand description
Model validator
Implementations§
Source§impl ModelValidator
impl ModelValidator
Sourcepub fn new(config: ValidationConfig) -> Self
pub fn new(config: ValidationConfig) -> Self
Create a new model validator
Sourcepub fn validate_tensor(&self, name: &str, tensor: &Tensor) -> ValidationResult
pub fn validate_tensor(&self, name: &str, tensor: &Tensor) -> ValidationResult
Validate tensor output
Sourcepub fn validate_config<C>(&self, config: &C) -> ValidationResultwhere
C: Config,
pub fn validate_config<C>(&self, config: &C) -> ValidationResultwhere
C: Config,
Validate a model configuration by delegating to the configuration’s own
Config::validate implementation.
The validator has no way to reason about an arbitrary struct’s invariants;
the configuration does. Anything that does not implement Config cannot
be validated here — which is why the bound is Config and not Debug.
Sourcepub fn validate_performance<F>(&self, model_fn: F) -> ValidationResult
pub fn validate_performance<F>(&self, model_fn: F) -> ValidationResult
Validate model performance
Sourcepub fn validate_model_performance<M>(
&self,
model: &M,
input: &Tensor,
) -> ValidationResult
pub fn validate_model_performance<M>( &self, model: &M, input: &Tensor, ) -> ValidationResult
Validate a model’s forward-pass performance and record its real parameter count.
Runs the same warm-up / timed-run protocol as
ModelValidator::validate_performance, but because it owns the model it
can report parameter_count from Model::num_parameters instead of
leaving it unmeasured.
Sourcepub fn compare_tensors(
&self,
name: &str,
expected: &Tensor,
actual: &Tensor,
) -> ValidationResult
pub fn compare_tensors( &self, name: &str, expected: &Tensor, actual: &Tensor, ) -> ValidationResult
Compare two tensors for numerical equality
Auto Trait Implementations§
impl Freeze for ModelValidator
impl RefUnwindSafe for ModelValidator
impl Send for ModelValidator
impl Sync for ModelValidator
impl Unpin for ModelValidator
impl UnsafeUnpin for ModelValidator
impl UnwindSafe for ModelValidator
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> 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