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
impl RuntimeTrace
Sourcepub fn validate(&self) -> Result<()>
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.
Sourcepub fn check_identity(
&self,
expected: &ExpectedIdentity,
) -> Vec<IdentityMismatch>
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.
Sourcepub fn require_identity(&self, expected: &ExpectedIdentity) -> Result<()>
pub fn require_identity(&self, expected: &ExpectedIdentity) -> Result<()>
Reject when supplied identity disagrees with expected.
Compatible when either side omits a field.
Sourcepub fn tensors_by_static_id(&self, static_id: &str) -> Vec<&TensorObservation>
pub fn tensors_by_static_id(&self, static_id: &str) -> Vec<&TensorObservation>
All tensor observations carrying static_id.
Sourcepub fn agreed_tensor(&self, static_id: &str) -> Option<&TensorObservation>
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.
Sourcepub fn tensor_confidence(&self, static_id: &str) -> ObservationConfidence
pub fn tensor_confidence(&self, static_id: &str) -> ObservationConfidence
Confidence for refining a static tensor from this trace.
Sourcepub fn gradients_for(&self, root: &str, key: &str) -> Vec<&GradientFact>
pub fn gradients_for(&self, root: &str, key: &str) -> Vec<&GradientFact>
Gradient facts for a builder-root + parameter-key identity.
Sourcepub fn gradient(&self, root: &str, key: &str) -> Option<&GradientFact>
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.
Sourcepub fn gradient_confidence(
&self,
root: &str,
key: &str,
) -> ObservationConfidence
pub fn gradient_confidence( &self, root: &str, key: &str, ) -> ObservationConfidence
Confidence for refining a parameter gradient from this trace.
Sourcepub fn audit(&self) -> RuntimeAudit
pub fn audit(&self) -> RuntimeAudit
Compact audit: gradient quality, tensor/gradient conflicts, optional identity mismatches.
Sourcepub fn audit_with_identity(
&self,
expected: Option<&ExpectedIdentity>,
) -> RuntimeAudit
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
impl Clone for RuntimeTrace
Source§fn clone(&self) -> RuntimeTrace
fn clone(&self) -> RuntimeTrace
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more