pub struct Op { /* private fields */ }
Expand description
Op is the Rc wrapper of typed op trait
Implementations
sourceimpl Op
impl Op
pub fn new(op: Rc<RefCell<Box<dyn OpTrait>>>) -> Self
pub fn ref_copy(&self) -> Self
pub fn get_name(&self) -> String
pub fn get_input_size(&self) -> usize
pub fn get_output_size(&self) -> usize
pub fn get_update_counter(&self) -> usize
sourcepub fn apply(&self, input: &[Tensor], output: &[Tensor])
pub fn apply(&self, input: &[Tensor], output: &[Tensor])
Read the input, do the calculation and write result to output. Called by compute_grapyh.
sourcepub fn grad(
&self,
input: &[Tensor],
output_grad: &[Tensor],
input_grad: &[Tensor]
)
pub fn grad(
&self,
input: &[Tensor],
output_grad: &[Tensor],
input_grad: &[Tensor]
)
Given input and output_grad, return input_grad (forward view) Called by compute_grapyh.
sourcepub fn get_values(&self) -> Vec<Tensor>
pub fn get_values(&self) -> Vec<Tensor>
access weight/paramenters
sourcepub fn set_values(&self, v: &[Tensor])
pub fn set_values(&self, v: &[Tensor])
set parameters
Auto Trait Implementations
impl !RefUnwindSafe for Op
impl !Send for Op
impl !Sync for Op
impl Unpin for Op
impl !UnwindSafe for Op
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more