Skip to main content

RuntimeTrace

Struct RuntimeTrace 

Source
pub struct RuntimeTrace {
    pub schema: String,
    pub run: RunMetadata,
    pub tensors: Vec<TensorObservation>,
    pub operations: Vec<OperationObservation>,
    pub gradients: Vec<GradientFact>,
    pub values: Vec<ValueObservation>,
    pub edge_timings: Vec<EdgeTimingObservation>,
}
Expand description

Full runtime trace document (candle-graph/runtime/1 or /2).

Fields§

§schema: String§run: RunMetadata§tensors: Vec<TensorObservation>§operations: Vec<OperationObservation>§gradients: Vec<GradientFact>§values: Vec<ValueObservation>§edge_timings: Vec<EdgeTimingObservation>

Implementations§

Source§

impl RuntimeTrace

Source

pub fn normalize(&mut self)

Sort collections deterministically for stable diffs and audits.

Source

pub fn validate(&self) -> Result<()>

Reject duplicate event ids and invalid gradient facts.

Contradictory tensor/gradient observations are not rejected here; they are reported by Self::audit as Unknown conflicts so importers never silently overwrite a winner.

Source

pub fn finalize(self) -> Result<Self>

Normalize then validate; returns a ready-to-query trace.

Source

pub fn check_identity( &self, expected: &ExpectedIdentity, ) -> Vec<IdentityMismatch>

Compare optional trace identity fields against an importer-supplied expectation.

Fields omitted on either side are skipped (backward compatible). When both sides supply a field and they differ, a mismatch is returned — callers must reject or report it as Unknown.

Source

pub fn require_identity(&self, expected: &ExpectedIdentity) -> Result<()>

Reject when supplied identity disagrees with expected.

Compatible when either side omits a field.

Source

pub fn tensors_by_static_id(&self, static_id: &str) -> Vec<&TensorObservation>

All tensor observations carrying static_id.

Source

pub fn agreed_tensor(&self, static_id: &str) -> Option<&TensorObservation>

Agreed tensor observation for static_id, if any.

Returns None when there are no observations or when shape/dtype/device conflict — never silently picks a contradictory winner.

Source

pub fn tensor_confidence(&self, static_id: &str) -> ObservationConfidence

Confidence for refining a static tensor from this trace.

Source

pub fn gradients_for(&self, root: &str, key: &str) -> Vec<&GradientFact>

Gradient facts for a builder-root + parameter-key identity.

Source

pub fn gradient(&self, root: &str, key: &str) -> Option<&GradientFact>

Agreed gradient fact for the identity, if any.

Returns None when facts are missing or contradictory (state/norm disagree). Does not silently overwrite by returning the first observation.

Source

pub fn gradient_confidence( &self, root: &str, key: &str, ) -> ObservationConfidence

Confidence for refining a parameter gradient from this trace.

Source

pub fn audit(&self) -> RuntimeAudit

Compact audit: gradient quality, tensor/gradient conflicts, optional identity mismatches.

Source

pub fn audit_with_identity( &self, expected: Option<&ExpectedIdentity>, ) -> RuntimeAudit

Like Self::audit, also reporting identity mismatches when expected is supplied.

Trait Implementations§

Source§

impl Clone for RuntimeTrace

Source§

fn clone(&self) -> RuntimeTrace

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuntimeTrace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RuntimeTrace

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for RuntimeTrace

Source§

fn eq(&self, other: &RuntimeTrace) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RuntimeTrace

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RuntimeTrace

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.