pub struct FusionOp {
pub id: usize,
pub kind: OpKind,
pub inputs: Vec<usize>,
pub output_shape: Vec<usize>,
pub dtype_bytes: usize,
}Expand description
A single operation in the fusion graph.
id equals the op’s insertion index in its FusionGraph. inputs lists
the op ids of the producers whose output tensors this op consumes; an empty
inputs list marks a source (leaf) op.
Fields§
§id: usizeStable identifier (equal to the insertion index in the graph).
kind: OpKindThe kind of operation.
inputs: Vec<usize>Op ids of the producers this op reads from.
output_shape: Vec<usize>Shape of this op’s output tensor (empty == scalar).
dtype_bytes: usizeSize in bytes of a single output element.
Implementations§
Source§impl FusionOp
impl FusionOp
Sourcepub fn output_elements(&self) -> Result<u64, GpuOptimError>
pub fn output_elements(&self) -> Result<u64, GpuOptimError>
Number of elements in the output tensor (product of the shape dims).
Returns an error if the product overflows a u64.
Sourcepub fn output_bytes(&self) -> Result<u64, GpuOptimError>
pub fn output_bytes(&self) -> Result<u64, GpuOptimError>
Size in bytes of the output tensor (product(shape) * dtype_bytes).
Returns an error if the computation overflows a u64.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FusionOp
impl RefUnwindSafe for FusionOp
impl Send for FusionOp
impl Sync for FusionOp
impl Unpin for FusionOp
impl UnsafeUnpin for FusionOp
impl UnwindSafe for FusionOp
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more