Ejemplo n.º 1
0
 public ConvolutionLayer(int filtersCount, int kernelSize, int stride, IWeightsInitializer initializer)
 {
     KernelSize   = kernelSize;
     Stride       = stride;
     FiltersCount = filtersCount;
     _initializer = initializer;
 }
Ejemplo n.º 2
0
 public ConvolutionLayer(int filtersCount, int kernelSize, int stride)
 {
     KernelSize   = kernelSize;
     Stride       = stride;
     FiltersCount = filtersCount;
     _initializer = new HeInitializer();
 }
Ejemplo n.º 3
0
        public FullyConnectedLayer(LayerInfo info) : base(info)
        {
            var fullyLayerInfo = info as ParameterizedLayerInfo;

            if (fullyLayerInfo == null)
            {
                throw new ArgumentException(nameof(info));
            }

            var wShape = new Shape(fullyLayerInfo.WeightsShape.B, fullyLayerInfo.WeightsShape.C, fullyLayerInfo.WeightsShape.H, fullyLayerInfo.WeightsShape.W);

            ParametersStorage.Weights = Builder.OfShape(wShape);
            ParametersStorage.Weights.Storage.Data = fullyLayerInfo.Weights;

            ParametersStorage.Gradients = Builder.OfShape(wShape.GetCopy());

            _initializer = new HeInitializer();
        }
Ejemplo n.º 4
0
        public ConvolutionLayer(LayerInfo info) : base(info)
        {
            var convLayerInfo = info as ConvolutionLayerInfo;

            if (convLayerInfo == null)
            {
                throw new ArgumentException(nameof(info));
            }

            var wShape = new Shape(convLayerInfo.WeightsShape.B, convLayerInfo.WeightsShape.C, convLayerInfo.WeightsShape.H, convLayerInfo.WeightsShape.W);

            FiltersCount = convLayerInfo.FiltersCount;
            Stride       = convLayerInfo.Stride;
            KernelSize   = convLayerInfo.KernelSize;

            ParametersStorage.Weights = Builder.OfShape(wShape);
            ParametersStorage.Weights.Storage.Data = convLayerInfo.Weights;
            ParametersStorage.Gradients            = Builder.OfShape(wShape.GetCopy());

            _initializer = new HeInitializer();

            InitializeBuffers();
        }
Ejemplo n.º 5
0
 public static NeuralLayeredNetwork Conv(this NeuralLayeredNetwork network, int filtersCount, int kernelSize, int stride, IWeightsInitializer initializer)
 {
     network.AddLayer(new ConvolutionLayer(filtersCount, kernelSize, stride, initializer));
     return(network);
 }
Ejemplo n.º 6
0
 public static NeuralLayeredNetwork Fully(this NeuralLayeredNetwork network, int neuronsCount, IWeightsInitializer initializer)
 {
     network.AddLayer(new FullyConnectedLayer(neuronsCount, initializer));
     return(network);
 }
Ejemplo n.º 7
0
 public FullyConnectedLayer(int neuronsCount)
 {
     NeuronsCount = neuronsCount;
     _initializer = new HeInitializer();
 }
Ejemplo n.º 8
0
 public FullyConnectedLayer(int neuronsCount, IWeightsInitializer initializer)
 {
     NeuronsCount = neuronsCount;
     _initializer = initializer;
 }