pub struct PyScGraphBuilder {
inner: Option<ScGraphBuilder>,
}Fields§
§inner: Option<ScGraphBuilder>Implementations§
Source§impl PyScGraphBuilder
impl PyScGraphBuilder
fn builder_mut(&mut self) -> PyResult<&mut ScGraphBuilder>
Source§impl PyScGraphBuilder
impl PyScGraphBuilder
fn new(name: String) -> Self
Sourcefn input(&mut self, name: &str, ty: &str) -> PyResult<u32>
fn input(&mut self, name: &str, ty: &str) -> PyResult<u32>
Add a typed input port. Returns value ID.
Sourcefn output(&mut self, name: &str, source_id: u32) -> PyResult<u32>
fn output(&mut self, name: &str, source_id: u32) -> PyResult<u32>
Add an output port forwarding a value.
Sourcefn constant_f64(&mut self, value: f64, ty: &str) -> PyResult<u32>
fn constant_f64(&mut self, value: f64, ty: &str) -> PyResult<u32>
Add a float constant.
Sourcefn constant_i64(&mut self, value: i64, ty: &str) -> PyResult<u32>
fn constant_i64(&mut self, value: i64, ty: &str) -> PyResult<u32>
Add an integer constant.
Sourcefn constant_f64_vec(&mut self, values: Vec<f64>, ty: &str) -> PyResult<u32>
fn constant_f64_vec(&mut self, values: Vec<f64>, ty: &str) -> PyResult<u32>
Add a float-vector constant.
Sourcefn kuramoto_step(
&mut self,
phases_id: u32,
omega_id: u32,
coupling_id: u32,
dt: f64,
) -> PyResult<u32>
fn kuramoto_step( &mut self, phases_id: u32, omega_id: u32, coupling_id: u32, dt: f64, ) -> PyResult<u32>
Add a single Kuramoto integration step over an explicit coupling matrix.
phases_id and omega_id are length-N vector constants; coupling_id
is the row-major N×N matrix K_nm. dt is the Euler step.
Sourcefn graph_forward(
&mut self,
features_id: u32,
adjacency_id: u32,
n_nodes: usize,
n_features: usize,
) -> PyResult<u32>
fn graph_forward( &mut self, features_id: u32, adjacency_id: u32, n_nodes: usize, n_features: usize, ) -> PyResult<u32>
Add a degree-normalised graph aggregation over an explicit adjacency matrix.
features_id is the n_nodes × n_features (node-major) constant vector and
adjacency_id the row-major n_nodes × n_nodes matrix.
Sourcefn softmax_attention(
&mut self,
q_id: u32,
k_id: u32,
v_id: u32,
dim_k: usize,
) -> PyResult<u32>
fn softmax_attention( &mut self, q_id: u32, k_id: u32, v_id: u32, dim_k: usize, ) -> PyResult<u32>
Add a single-head scaled-dot-product softmax attention op.
q_id is q_rows × dim_k, k_id is k_rows × dim_k and v_id is
k_rows × v_cols (row-major constant vectors); shapes are inferred from
their lengths and dim_k at emit time.
Sourcefn encode(&mut self, prob_id: u32, length: usize, seed: u64) -> PyResult<u32>
fn encode(&mut self, prob_id: u32, length: usize, seed: u64) -> PyResult<u32>
Add a Bernoulli encode operation.
Sourcefn bitwise_and(&mut self, lhs_id: u32, rhs_id: u32) -> PyResult<u32>
fn bitwise_and(&mut self, lhs_id: u32, rhs_id: u32) -> PyResult<u32>
Add a bitwise AND (SC multiply).
Sourcefn lif_step(
&mut self,
current_id: u32,
leak_id: u32,
gain_id: u32,
noise_id: u32,
data_width: u32,
fraction: u32,
v_rest: i64,
v_reset: i64,
v_threshold: i64,
refractory_period: u32,
) -> PyResult<u32>
fn lif_step( &mut self, current_id: u32, leak_id: u32, gain_id: u32, noise_id: u32, data_width: u32, fraction: u32, v_rest: i64, v_reset: i64, v_threshold: i64, refractory_period: u32, ) -> PyResult<u32>
Add a LIF neuron step.
Sourcefn dense_forward(
&mut self,
inputs_id: u32,
weights_id: u32,
leak_id: u32,
gain_id: u32,
n_inputs: usize,
n_neurons: usize,
data_width: u32,
stream_length: usize,
seed_base: u64,
y_min: i64,
y_max: i64,
) -> PyResult<u32>
fn dense_forward( &mut self, inputs_id: u32, weights_id: u32, leak_id: u32, gain_id: u32, n_inputs: usize, n_neurons: usize, data_width: u32, stream_length: usize, seed_base: u64, y_min: i64, y_max: i64, ) -> PyResult<u32>
Add a dense layer forward pass.
Sourcefn scale(&mut self, input_id: u32, factor: f64) -> PyResult<u32>
fn scale(&mut self, input_id: u32, factor: f64) -> PyResult<u32>
Add a scale (multiply by constant factor) operation.
Sourcefn offset(&mut self, input_id: u32, offset_val: f64) -> PyResult<u32>
fn offset(&mut self, input_id: u32, offset_val: f64) -> PyResult<u32>
Add an offset (add constant) operation.
Trait Implementations§
impl DerefToPyAny for PyScGraphBuilder
impl ExtractPyClassWithClone for PyScGraphBuilder
Source§impl<'py> IntoPyObject<'py> for PyScGraphBuilder
impl<'py> IntoPyObject<'py> for PyScGraphBuilder
Source§type Target = PyScGraphBuilder
type Target = PyScGraphBuilder
Source§type Output = Bound<'py, <PyScGraphBuilder as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PyScGraphBuilder as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for PyScGraphBuilder
impl PyClass for PyScGraphBuilder
Source§impl PyClassImpl for PyScGraphBuilder
impl PyClassImpl for PyScGraphBuilder
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = c"\x00"
const RAW_DOC: &'static CStr = c"\x00"
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<PyScGraphBuilder as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<PyScGraphBuilder>
type Layout = <<PyScGraphBuilder as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<PyScGraphBuilder>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for PyScGraphBuilder
impl PyClassNewTextSignature for PyScGraphBuilder
const TEXT_SIGNATURE: &'static str = "(name)"
Source§impl PyMethods<PyScGraphBuilder> for PyClassImplCollector<PyScGraphBuilder>
impl PyMethods<PyScGraphBuilder> for PyClassImplCollector<PyScGraphBuilder>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for PyScGraphBuilder
impl PyTypeInfo for PyScGraphBuilder
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.Auto Trait Implementations§
impl Freeze for PyScGraphBuilder
impl RefUnwindSafe for PyScGraphBuilder
impl Send for PyScGraphBuilder
impl Sync for PyScGraphBuilder
impl Unpin for PyScGraphBuilder
impl UnsafeUnpin for PyScGraphBuilder
impl UnwindSafe for PyScGraphBuilder
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
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> ⓘ
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> ⓘ
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§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.