pub struct BinaryCustomOp<F, G>{ /* private fields */ }Expand description
Binary custom operation for element-wise operations
Implementations§
Trait Implementations§
Source§impl<F, G> CustomOp for BinaryCustomOp<F, G>
impl<F, G> CustomOp for BinaryCustomOp<F, G>
Source§fn num_inputs(&self) -> usize
fn num_inputs(&self) -> usize
Number of inputs expected.
Source§fn forward(
&self,
inputs: &[&Scirs2Tensor],
_ctx: &mut CustomOpContext,
) -> Result<Scirs2Tensor, String>
fn forward( &self, inputs: &[&Scirs2Tensor], _ctx: &mut CustomOpContext, ) -> Result<Scirs2Tensor, String>
Execute the forward pass.
Source§fn backward(
&self,
grad: &Scirs2Tensor,
inputs: &[&Scirs2Tensor],
_ctx: &CustomOpContext,
) -> Result<Vec<Scirs2Tensor>, String>
fn backward( &self, grad: &Scirs2Tensor, inputs: &[&Scirs2Tensor], _ctx: &CustomOpContext, ) -> Result<Vec<Scirs2Tensor>, String>
Execute the backward pass (compute gradients). Read more
Source§fn validate_inputs(&self, inputs: &[&Scirs2Tensor]) -> Result<(), String>
fn validate_inputs(&self, inputs: &[&Scirs2Tensor]) -> Result<(), String>
Validate input shapes before execution.
Auto Trait Implementations§
impl<F, G> Freeze for BinaryCustomOp<F, G>
impl<F, G> RefUnwindSafe for BinaryCustomOp<F, G>where
F: RefUnwindSafe,
G: RefUnwindSafe,
impl<F, G> Send for BinaryCustomOp<F, G>
impl<F, G> Sync for BinaryCustomOp<F, G>
impl<F, G> Unpin for BinaryCustomOp<F, G>
impl<F, G> UnwindSafe for BinaryCustomOp<F, G>where
F: UnwindSafe,
G: UnwindSafe,
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