pub enum SubgraphPattern {
Declarative(PatternTree),
Callable(fn(&Graph, NodeId) -> Option<PatternMatch>),
}Expand description
Canonical primitive-subgraph pattern that a fused op represents. Used by fusion rules.
Two reasonable shapes; the registry supports both:
Callable— a closure-style matcher, mirrors PR 3’scanonical_softmax_pattern. Maximally flexible (consumer-count guards, cross-checks); less analyzable.Declarative— a recursivePatternTreethat the rule engine compiles to a matcher. More analyzable; auto-generation from the registry entry is straightforward.
Step 3 ports SoftmaxLastDim’s existing matcher to Callable. The
declarative form (see Q1 in docs/fused-op-registry.md) is wired up
in step 4 once a second op exercises the abstraction.
Variants§
Declarative(PatternTree)
Callable(fn(&Graph, NodeId) -> Option<PatternMatch>)
Auto Trait Implementations§
impl Forget for SubgraphPattern
impl Freeze for SubgraphPatternwhere
*const u8 is !null: Freeze,
PhantomData<PatternNode>: Freeze,
PhantomData<f64>: Freeze,
PhantomData<u8>: Freeze,
PhantomData<i64>: Freeze,
PhantomData<(u64, u64)>: Freeze,
*const Dim is !null: Freeze,
PhantomData<Dim>: Freeze,
*const PatternNode is !null: Freeze,
impl Move for SubgraphPattern
impl RefUnwindSafe for SubgraphPattern
impl Send for SubgraphPattern
impl Sync for SubgraphPattern
impl Unpin for SubgraphPattern
impl UnsafeUnpin for SubgraphPatternwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<PatternNode>: UnsafeUnpin,
PhantomData<f64>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<i64>: UnsafeUnpin,
PhantomData<(u64, u64)>: UnsafeUnpin,
*const Dim is !null: UnsafeUnpin,
PhantomData<Dim>: UnsafeUnpin,
*const PatternNode is !null: UnsafeUnpin,
impl UnwindSafe for SubgraphPattern
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