pub struct RawOutput {
pub f32_bits: Vec<u32>,
}Expand description
Exact IEEE-754 output representation, including non-finite and signed-zero values. Unlike JSON float arrays this does not silently turn NaN into null.
Fields§
§f32_bits: Vec<u32>Implementations§
Source§impl RawOutput
impl RawOutput
pub fn from_f32(values: &[f32]) -> RawOutput
Sourcepub fn to_f32(&self) -> Vec<f32>
pub fn to_f32(&self) -> Vec<f32>
Examples found in repository?
examples/backend_numerics.rs (line 84)
63fn bind_submission_segments(
64 report: &mut RequiredReport,
65 config: &Config,
66) -> Option<Vec<NumericalMetrics>> {
67 let config::Operation::MetalContext {
68 tokens,
69 intermediate,
70 k,
71 } = config.op
72 else {
73 return None;
74 };
75 let (Some(reference), Some(actual)) = (&report.reference, &report.actual) else {
76 return None;
77 };
78 match compare_submission_segments(
79 &MetalContextOp {
80 tokens,
81 intermediate,
82 k,
83 },
84 &reference.to_f32(),
85 &actual.to_f32(),
86 config.max_nmse,
87 ) {
88 Ok(metrics) => Some(metrics),
89 Err(error) => {
90 report.status = RequiredStatus::Failed;
91 report.reason = Some(match report.reason.take() {
92 Some(previous) => format!("{previous}; {error}"),
93 None => error,
94 });
95 None
96 }
97 }
98}Trait Implementations§
Source§impl<'de> Deserialize<'de> for RawOutput
impl<'de> Deserialize<'de> for RawOutput
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RawOutput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RawOutput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RawOutput
Source§impl Serialize for RawOutput
impl Serialize for RawOutput
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 RawOutput
Auto Trait Implementations§
impl Freeze for RawOutput
impl RefUnwindSafe for RawOutput
impl Send for RawOutput
impl Sync for RawOutput
impl Unpin for RawOutput
impl UnsafeUnpin for RawOutput
impl UnwindSafe for RawOutput
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,
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§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> 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