Realm

oa::ml::nn::Bilinear

Trainable bilinear interaction out[n, o] = sum_i,j x1[n,i] W[o,i,j] x2[n,j] + b[o]. The weight uses the donor [O, I1, I2] layout and Xavier-uniform initialization matching nn.Linear.

StRust public API

Declaration

pub struct Bilinear { /* private fields */ }
Public Rust declaration.

Public Methods

pub fn weight(&self) -> Parameter
pub fn bias(&self) -> Option<Parameter>
pub fn forward2(&self, input1: &Matrix, input2: &Matrix) -> Result<Matrix>
fn forward(&self, input: &Matrix) -> Result<Matrix>
fn registry(&self) -> &ModuleRegistry
fn parameters(&self) -> Vec<Parameter>
fn named_parameters(&self) -> Vec<NamedParameter>
fn buffers(&self) -> Vec<Matrix>
fn named_buffers(&self) -> Vec<NamedBuffer>
fn all_parameters(&self) -> Result<Vec<Parameter>>
fn all_named_parameters(&self) -> Result<Vec<NamedParameter>>
fn all_named_buffers(&self) -> Result<Vec<NamedBuffer>>
fn all_named_state_u32(&self) -> Result<Vec<NamedStateU32>>
fn num_parameters(&self) -> Result<usize>
fn train(&self, training: bool)
fn eval(&self)
fn is_training(&self) -> bool
fn scoped_eval(&self) -> ScopedEval<'_>

Associated Functions

pub fn new( in1_features: usize, in2_features: usize, out_features: usize, ) -> Result<Self>
pub fn new_with_seed( in1_features: usize, in2_features: usize, out_features: usize, trainable_bias: bool, seed: u64, ) -> Result<Self>
pub fn new_with_seed_on( runtime: &Runtime, in1_features: usize, in2_features: usize, out_features: usize, trainable_bias: bool, seed: u64, ) -> Result<Self>
pub fn new_from_matrices(weight: Matrix, bias: Matrix) -> Result<Self>

Public Method Documentation

pub fn weight( &self ) -> Parameter
No public source comment is attached to this declaration.
pub fn bias( &self ) -> Option<Parameter>
No public source comment is attached to this declaration.
pub fn forward2( &self, input1: &Matrix, input2: &Matrix ) -> Result<Matrix>
No public source comment is attached to this declaration.
fn forward( &self, input: &Matrix ) -> Result<Matrix>
No public source comment is attached to this declaration.
fn registry( &self ) -> &ModuleRegistry
No public source comment is attached to this declaration.
fn parameters( &self ) -> Vec<Parameter>
No public source comment is attached to this declaration.
fn named_parameters( &self ) -> Vec<NamedParameter>
No public source comment is attached to this declaration.
fn buffers( &self ) -> Vec<Matrix>
No public source comment is attached to this declaration.
fn named_buffers( &self ) -> Vec<NamedBuffer>
No public source comment is attached to this declaration.
fn all_parameters( &self ) -> Result<Vec<Parameter>>
No public source comment is attached to this declaration.
fn all_named_parameters( &self ) -> Result<Vec<NamedParameter>>
No public source comment is attached to this declaration.
fn all_named_buffers( &self ) -> Result<Vec<NamedBuffer>>
No public source comment is attached to this declaration.
fn all_named_state_u32( &self ) -> Result<Vec<NamedStateU32>>
No public source comment is attached to this declaration.
fn num_parameters( &self ) -> Result<usize>
No public source comment is attached to this declaration.
fn train( &self, training: bool )
No public source comment is attached to this declaration.
fn eval( &self )
No public source comment is attached to this declaration.
fn is_training( &self ) -> bool
No public source comment is attached to this declaration.
fn scoped_eval( &self ) -> ScopedEval<'_>
No public source comment is attached to this declaration.
pub fn new( in1_features: usize, in2_features: usize, out_features: usize ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn new_with_seed( in1_features: usize, in2_features: usize, out_features: usize, trainable_bias: bool, seed: u64 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn new_with_seed_on( runtime: &Runtime, in1_features: usize, in2_features: usize, out_features: usize, trainable_bias: bool, seed: u64 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn new_from_matrices( weight: Matrix, bias: Matrix ) -> Result<Self>
No public source comment is attached to this declaration.