pub trait TracedModule<X>: Module<X> {
type Trace;
// Required method
fn traced_forward(
&self,
x: X,
) -> Result<(<Self as Module<X>>::Output, Self::Trace), Error>;
}
Expand description
Some sequential computation that consumes Input
and produces Module::Output,
but also produces artifacts describing the execution that can later be used
during backprop.
Neural-network layers implement this trait.
A supertrait of Module.
Required Associated Types§
Required Methods§
Sourcefn traced_forward(
&self,
x: X,
) -> Result<(<Self as Module<X>>::Output, Self::Trace), Error>
fn traced_forward( &self, x: X, ) -> Result<(<Self as Module<X>>::Output, Self::Trace), Error>
Same as Module::forward, except intermediate computations that are needed for backprop are returned.