Exemplo n.º 1
0
 /**
  * Create the IdentityConnection object using the specified input layer and
  * output layer.
  *
  * @param InputLayerType The input layer which is connected with the output
  * layer.
  * @param OutputLayerType The output layer which is connected with the input
  * layer.
  */
 IdentityConnection(InputLayerType& inputLayer,
                   OutputLayerType& outputLayer) :
     inputLayer(inputLayer),
     outputLayer(outputLayer),
     optimizer(0),
     weights(0),
     delta(arma::zeros<DataType>(inputLayer.Delta().n_rows,
         inputLayer.Delta().n_cols, inputLayer.Delta().n_slices))
 {
   // Nothing to do here.
 }
Exemplo n.º 2
0
 /**
  * Create the PoolingConnection object using the specified input layer, output
  * layer, optimizer and pooling strategy.
  *
  * @param InputLayerType The input layer which is connected with the output
  * layer.
  * @param OutputLayerType The output layer which is connected with the input
  * layer.
  * @param PoolingRule The strategy of pooling.
  */
 PoolingConnection(InputLayerType& inputLayer,
                   OutputLayerType& outputLayer,
                   PoolingRule pooling = PoolingRule()) :
     inputLayer(inputLayer),
     outputLayer(outputLayer),
     optimizer(0),
     weights(0),
     pooling(pooling),
     delta(arma::zeros<DataType>(inputLayer.Delta().n_rows,
         inputLayer.Delta().n_cols, inputLayer.Delta().n_slices))
 {
   // Nothing to do here.
 }
Exemplo n.º 3
0
 /**
  * Create the SelfConnection object using the specified input layer, output
  * layer, optimizer and weight initialize rule.
  *
  * @param InputLayerType The input layer which is connected with the output
  * layer.
  * @param OutputLayerType The output layer which is connected with the input
  * layer.
  * @param OptimizerType The optimizer used to update the weight matrix.
  * @param WeightInitRule The weight initialize rule used to initialize the
  * weight matrix.
  */
 SelfConnection(InputLayerType& inputLayer,
                OutputLayerType& outputLayer,
                OptimizerType& optimizer,
                WeightInitRule weightInitRule = WeightInitRule()) :
     inputLayer(inputLayer),
     outputLayer(outputLayer),
     optimizer(optimizer),
     connection(1 - arma::eye<MatType>(inputLayer.OutputSize(),
         inputLayer.OutputSize()))
 {
   weightInitRule.Initialize(weights, outputLayer.InputSize(),
       inputLayer.OutputSize());
 }
Exemplo n.º 4
0
 /**
  * Create the FullConnection object using the specified input layer, output
  * layer, optimizer and weight initialize rule.
  *
  * @param InputLayerType The input layer which is connected with the output
  * layer.
  * @param OutputLayerType The output layer which is connected with the input
  * layer.
  * @param OptimizerType The optimizer used to update the weight matrix.
  * @param WeightInitRule The weight initialize rule used to initialize the
  * weight matrix.
  */
 FullConnection(InputLayerType& inputLayer,
                OutputLayerType& outputLayer,
                OptimizerType& optimizer,
                WeightInitRule weightInitRule = WeightInitRule()) :
     inputLayer(inputLayer), outputLayer(outputLayer), optimizer(optimizer)
 {
   weightInitRule.Initialize(weights, outputLayer.InputSize(),
       inputLayer.OutputSize());
 }
Exemplo n.º 5
0
 /**
  * Create the SelfConnection object using the specified input layer, output
  * layer, optimizer and weight initialize rule.
  *
  * @param InputLayerType The input layer which is connected with the output
  * layer.
  * @param OutputLayerType The output layer which is connected with the input
  * layer.
  * @param OptimizerType The optimizer used to update the weight matrix.
  * @param WeightInitRule The weight initialize rule used to initialize the
  * weight matrix.
  */
 SelfConnection(InputLayerType& inputLayer,
                OutputLayerType& outputLayer,
                WeightInitRule weightInitRule = WeightInitRule()) :
     inputLayer(inputLayer),
     outputLayer(outputLayer),
     optimizer(new OptimizerType<SelfConnection<InputLayerType,
                                                OutputLayerType,
                                                OptimizerType,
                                                WeightInitRule,
                                                MatType,
                                                VecType>, MatType>(*this)),
     ownsOptimizer(true),
     connection(1 - arma::eye<MatType>(inputLayer.OutputSize(),
         inputLayer.OutputSize()))
 {
   weightInitRule.Initialize(weights, outputLayer.InputSize(),
       inputLayer.OutputSize());
 }
Exemplo n.º 6
0
 /**
  * Create the ConvConnection object using the specified input layer, output
  * layer, filter size and weight initialization rule.
  *
  * @param InputLayerType The input layer which is connected with the output
  * layer.
  * @param OutputLayerType The output layer which is connected with the input
  * layer.
  * @param filterSize the size of the filter.
  * @param WeightInitRule The weights initialization rule used to initialize
  * the weights matrix.
  */
 ConvConnection(InputLayerType& inputLayer,
                OutputLayerType& outputLayer,
                const size_t filterSize,
                WeightInitRule weightInitRule = WeightInitRule()) :
     inputLayer(inputLayer),
     outputLayer(outputLayer),
     optimizer(new OptimizerType<ConvConnection<InputLayerType,
                                                OutputLayerType,
                                                OptimizerType,
                                                WeightInitRule,
                                                ForwardConvolutionRule,
                                                BackwardConvolutionRule,
                                                GradientConvolutionRule,
                                                DataType>, DataType>(*this)),
     ownsOptimizer(true)
 {
   weightInitRule.Initialize(weights, filterSize, filterSize,
       inputLayer.OutputMaps() * outputLayer.OutputMaps());
 }