pub struct TensorSpec {
pub shape: Vec<u64>,
pub dtype: TensorDType,
pub layout: TensorLayout,
pub device: String,
}Expand description
Exact shape, scalar, layout, and device of one diffusion state.
Fields§
§shape: Vec<u64>Positive dimensions in native order.
dtype: TensorDTypeNative scalar representation.
layout: TensorLayoutContiguous layout exposed to callbacks.
device: StringAdapter-reported device identity.
Implementations§
Source§impl TensorSpec
impl TensorSpec
Sourcepub fn new(
shape: Vec<u64>,
dtype: TensorDType,
layout: TensorLayout,
device: impl Into<String>,
) -> Result<Self, CoreError>
pub fn new( shape: Vec<u64>, dtype: TensorDType, layout: TensorLayout, device: impl Into<String>, ) -> Result<Self, CoreError>
Constructs and validates a tensor contract.
§Errors
Returns an error for invalid rank, dimensions, element count, or device.
Sourcepub fn validate(&self) -> Result<(), CoreError>
pub fn validate(&self) -> Result<(), CoreError>
Validates rank, dimensions, element count, and device identity.
§Errors
Returns the first invalid tensor invariant.
Trait Implementations§
Source§impl Clone for TensorSpec
impl Clone for TensorSpec
Source§impl Debug for TensorSpec
impl Debug for TensorSpec
Source§impl<'de> Deserialize<'de> for TensorSpec
impl<'de> Deserialize<'de> for TensorSpec
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 Eq for TensorSpec
Source§impl PartialEq for TensorSpec
impl PartialEq for TensorSpec
Source§impl Serialize for TensorSpec
impl Serialize for TensorSpec
impl StructuralPartialEq for TensorSpec
Auto Trait Implementations§
impl Freeze for TensorSpec
impl RefUnwindSafe for TensorSpec
impl Send for TensorSpec
impl Sync for TensorSpec
impl Unpin for TensorSpec
impl UnsafeUnpin for TensorSpec
impl UnwindSafe for TensorSpec
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