/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * Create the ConvConnection object using the specified input layer, output * layer, filter size, optimizer 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 OptimizerType The optimizer used to update the weight matrix. * @param WeightInitRule The weights initialization rule used to initialize * the weights matrix. */ ConvConnection(InputLayerType& inputLayer, OutputLayerType& outputLayer, const size_t filterSize, OptimizerType<ConvConnection<InputLayerType, OutputLayerType, OptimizerType, WeightInitRule, ForwardConvolutionRule, BackwardConvolutionRule, GradientConvolutionRule, DataType>, DataType>& optimizer, WeightInitRule weightInitRule = WeightInitRule()) : inputLayer(inputLayer), outputLayer(outputLayer), optimizer(&optimizer), ownsOptimizer(false) { weightInitRule.Initialize(weights, filterSize, filterSize, outputLayer.LayerSlices()); }