|
|
@ -1,6 +1,6 @@
|
|
|
|
use super::{NeuraTrainableNetwork, NeuraTrainableNetworkBase};
|
|
|
|
use super::{NeuraOldTrainableNetwork, NeuraOldTrainableNetworkBase};
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
|
gradient_solver::{NeuraGradientSolverFinal, NeuraGradientSolverTransient},
|
|
|
|
gradient_solver::{NeuraGradientSolverTransient},
|
|
|
|
layer::{
|
|
|
|
layer::{
|
|
|
|
NeuraLayer, NeuraPartialLayer, NeuraShape, NeuraTrainableLayerBase, NeuraTrainableLayerSelf,
|
|
|
|
NeuraLayer, NeuraPartialLayer, NeuraShape, NeuraTrainableLayerBase, NeuraTrainableLayerSelf,
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -82,8 +82,8 @@ impl<Layer, ChildNetwork> NeuraSequential<Layer, ChildNetwork> {
|
|
|
|
impl<
|
|
|
|
impl<
|
|
|
|
Input,
|
|
|
|
Input,
|
|
|
|
Layer: NeuraTrainableLayerBase<Input> + NeuraTrainableLayerSelf<Input>,
|
|
|
|
Layer: NeuraTrainableLayerBase<Input> + NeuraTrainableLayerSelf<Input>,
|
|
|
|
ChildNetwork: NeuraTrainableNetworkBase<Layer::Output>,
|
|
|
|
ChildNetwork: NeuraOldTrainableNetworkBase<Layer::Output>,
|
|
|
|
> NeuraTrainableNetworkBase<Input> for NeuraSequential<Layer, ChildNetwork>
|
|
|
|
> NeuraOldTrainableNetworkBase<Input> for NeuraSequential<Layer, ChildNetwork>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
type Gradient = (Layer::Gradient, Box<ChildNetwork::Gradient>);
|
|
|
|
type Gradient = (Layer::Gradient, Box<ChildNetwork::Gradient>);
|
|
|
|
type LayerOutput = Layer::Output;
|
|
|
|
type LayerOutput = Layer::Output;
|
|
|
@ -114,7 +114,7 @@ impl<
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// A dummy implementation of `NeuraTrainableNetwork`, which simply calls `loss.eval` in `backpropagate`.
|
|
|
|
/// A dummy implementation of `NeuraTrainableNetwork`, which simply calls `loss.eval` in `backpropagate`.
|
|
|
|
impl<Input: Clone> NeuraTrainableNetworkBase<Input> for () {
|
|
|
|
impl<Input: Clone> NeuraOldTrainableNetworkBase<Input> for () {
|
|
|
|
type Gradient = ();
|
|
|
|
type Gradient = ();
|
|
|
|
type LayerOutput = Input;
|
|
|
|
type LayerOutput = Input;
|
|
|
|
|
|
|
|
|
|
|
@ -143,10 +143,10 @@ impl<
|
|
|
|
Input,
|
|
|
|
Input,
|
|
|
|
Layer: NeuraTrainableLayerBase<Input> + NeuraTrainableLayerSelf<Input>,
|
|
|
|
Layer: NeuraTrainableLayerBase<Input> + NeuraTrainableLayerSelf<Input>,
|
|
|
|
Optimizer: NeuraGradientSolverTransient<Input, Layer>,
|
|
|
|
Optimizer: NeuraGradientSolverTransient<Input, Layer>,
|
|
|
|
ChildNetwork: NeuraTrainableNetworkBase<Layer::Output>,
|
|
|
|
ChildNetwork: NeuraOldTrainableNetworkBase<Layer::Output>,
|
|
|
|
> NeuraTrainableNetwork<Input, Optimizer> for NeuraSequential<Layer, ChildNetwork>
|
|
|
|
> NeuraOldTrainableNetwork<Input, Optimizer> for NeuraSequential<Layer, ChildNetwork>
|
|
|
|
where
|
|
|
|
where
|
|
|
|
ChildNetwork: NeuraTrainableNetwork<Layer::Output, Optimizer>,
|
|
|
|
ChildNetwork: NeuraOldTrainableNetwork<Layer::Output, Optimizer>,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fn traverse(
|
|
|
|
fn traverse(
|
|
|
|
&self,
|
|
|
|
&self,
|
|
|
|