pub enum Scalar {
Int(i64),
UInt(u64),
Float(f64),
Bool(bool),
}Expand description
A typed scalar value stored alongside tensors in a burnpack container.
Scalars are kept in the CBOR metadata section (not the tensor data section), so they carry no alignment cost. The field is optional in the format: files written before scalar support simply omit it, and readers default it to empty.
Convert to/from the primitive numeric and boolean types with From / TryFrom
(e.g. Scalar::from(3usize), u32::try_from(scalar)).
Variants§
Int(i64)
A signed integer.
UInt(u64)
An unsigned integer.
Float(f64)
A floating-point number.
Bool(bool)
A boolean.
Trait Implementations§
impl Copy for Scalar
Source§impl<'de> Deserialize<'de> for Scalar
impl<'de> Deserialize<'de> for Scalar
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Scalar
Auto Trait Implementations§
impl Freeze for Scalar
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnsafeUnpin for Scalar
impl UnwindSafe for Scalar
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