pub struct OpInfo {
pub prim: Prim,
pub dtypes: Vec<DType>,
pub samples: SamplesFn,
pub xla_tolerance: Option<(f64, f64)>,
pub xla_only: bool,
}Expand description
The test declaration of one primitive.
Fields§
§prim: PrimThe primitive.
dtypes: Vec<DType>The element types whose samples must be accepted. Other types are tried as well, and checked against XLA when the primitive accepts them.
samples: SamplesFnCreates the samples for one element type.
xla_tolerance: Option<(f64, f64)>A looser tolerance (rtol, atol) for floats against XLA than
xla_tolerance, if needed.
xla_only: boolWhether only XLA runs the primitive (extern_call): the samples
then carry expected values, against which XLA is checked, and the
interpreter and the native backend are not checked.
Implementations§
Source§impl OpInfo
impl OpInfo
Sourcepub fn new(
prim: Prim,
dtypes: &[DType],
samples: impl Fn(&mut Rng, DType) -> Vec<Sample> + Send + Sync + 'static,
) -> Self
pub fn new( prim: Prim, dtypes: &[DType], samples: impl Fn(&mut Rng, DType) -> Vec<Sample> + Send + Sync + 'static, ) -> Self
Creates a declaration.
Sourcepub fn xla_tolerance(self, rtol: f64, atol: f64) -> Self
pub fn xla_tolerance(self, rtol: f64, atol: f64) -> Self
Sets the tolerance for floats against XLA.
Sourcepub fn xla_only(self) -> Self
pub fn xla_only(self) -> Self
Marks the primitive as run only by XLA (see OpInfo::xla_only).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for OpInfo
impl !UnwindSafe for OpInfo
impl Freeze for OpInfo
impl Send for OpInfo
impl Sync for OpInfo
impl Unpin for OpInfo
impl UnsafeUnpin for OpInfo
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