pub struct ScGraphBuilder {
graph: ScGraph,
}Expand description
Builder for constructing ScGraph instances.
Fields§
§graph: ScGraphImplementations§
Source§impl ScGraphBuilder
impl ScGraphBuilder
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Start building a new graph with the given module name.
Sourcepub fn input(&mut self, name: impl Into<String>, ty: ScType) -> ValueId
pub fn input(&mut self, name: impl Into<String>, ty: ScType) -> ValueId
Add a module input port.
Sourcepub fn output(&mut self, name: impl Into<String>, source: ValueId) -> ValueId
pub fn output(&mut self, name: impl Into<String>, source: ValueId) -> ValueId
Add a module output port.
Sourcepub fn encode(&mut self, prob: ValueId, length: usize, seed: u16) -> ValueId
pub fn encode(&mut self, prob: ValueId, length: usize, seed: u16) -> ValueId
Add a bitstream encode operation.
Sourcepub fn bitwise_and(&mut self, lhs: ValueId, rhs: ValueId) -> ValueId
pub fn bitwise_and(&mut self, lhs: ValueId, rhs: ValueId) -> ValueId
Add a bitwise AND (stochastic multiply).
Sourcepub fn lif_step(
&mut self,
current: ValueId,
leak: ValueId,
gain: ValueId,
noise: ValueId,
params: LifParams,
) -> ValueId
pub fn lif_step( &mut self, current: ValueId, leak: ValueId, gain: ValueId, noise: ValueId, params: LifParams, ) -> ValueId
Add a LIF neuron step.
Sourcepub fn dense_forward(
&mut self,
inputs: ValueId,
weights: ValueId,
leak: ValueId,
gain: ValueId,
params: DenseParams,
) -> ValueId
pub fn dense_forward( &mut self, inputs: ValueId, weights: ValueId, leak: ValueId, gain: ValueId, params: DenseParams, ) -> ValueId
Add a dense SC layer forward pass.
Sourcepub fn bitwise_xor(&mut self, lhs: ValueId, rhs: ValueId) -> ValueId
pub fn bitwise_xor(&mut self, lhs: ValueId, rhs: ValueId) -> ValueId
Add a bitwise XOR (HDC binding).
Sourcepub fn reduce(&mut self, input: ValueId, mode: ReduceMode) -> ValueId
pub fn reduce(&mut self, input: ValueId, mode: ReduceMode) -> ValueId
Add a reduce operation (Sum or Max).
Sourcepub fn graph_forward(
&mut self,
features: ValueId,
adjacency: ValueId,
n_nodes: usize,
n_features: usize,
) -> ValueId
pub fn graph_forward( &mut self, features: ValueId, adjacency: ValueId, n_nodes: usize, n_features: usize, ) -> ValueId
Add a graph forward pass.
Sourcepub fn softmax_attention(
&mut self,
q: ValueId,
k: ValueId,
v: ValueId,
dim_k: usize,
) -> ValueId
pub fn softmax_attention( &mut self, q: ValueId, k: ValueId, v: ValueId, dim_k: usize, ) -> ValueId
Add a softmax attention operation.
Sourcepub fn kuramoto_step(
&mut self,
phases: ValueId,
omega: ValueId,
coupling: ValueId,
dt: f64,
) -> ValueId
pub fn kuramoto_step( &mut self, phases: ValueId, omega: ValueId, coupling: ValueId, dt: f64, ) -> ValueId
Add a Kuramoto integration step.
Sourcepub fn scale(&mut self, input: ValueId, factor: f64) -> ValueId
pub fn scale(&mut self, input: ValueId, factor: f64) -> ValueId
Add a scale (multiply by constant) operation.
Sourcepub fn offset(&mut self, input: ValueId, offset_val: f64) -> ValueId
pub fn offset(&mut self, input: ValueId, offset_val: f64) -> ValueId
Add an offset (add constant) operation.
Auto Trait Implementations§
impl Freeze for ScGraphBuilder
impl RefUnwindSafe for ScGraphBuilder
impl Send for ScGraphBuilder
impl Sync for ScGraphBuilder
impl Unpin for ScGraphBuilder
impl UnsafeUnpin for ScGraphBuilder
impl UnwindSafe for ScGraphBuilder
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
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