pub fn ad_admission<T: Scalar>(order: u32) -> Result<(), AdAdmissionError>Expand description
Answer whether the shared differentiation paths may differentiate T at
order.
This is a query. It does not run kernels, register rules, or change existing differentiation, and a rejection is always explicit: an unsupported scalar or order is never silently treated as a zero gradient.
§Examples
use tenferro_tensor_core::{ad_admission, AdAdmissionError};
// A non-field scalar is rejected even at first order.
assert_eq!(ad_admission::<bool>(1), Err(AdAdmissionError::NonFieldScalar));
// A field scalar with no rules yet is rejected as unavailable, not as zero.
assert_eq!(
ad_admission::<f64>(1),
Err(AdAdmissionError::AdRuleUnavailable)
);§Errors
Returns AdAdmissionError::UnsupportedAdOrder for any order other than
one, AdAdmissionError::NonFieldScalar for a scalar whose arithmetic is
not an ordinary field, and AdAdmissionError::AdRuleUnavailable when no
rules exist for an otherwise admissible scalar.