Пример #1
0
 /// <summary>
 /// Max pool layer.
 /// The max pool layers function is to progressively reduce the spatial size of the representation
 /// to reduce the amount of parameters and computation in the network.
 /// The reduction is only done on the width and height. Depth dimension is preserved.
 /// </summary>
 /// <param name="poolWidth">The width of the pool area (default is 2)</param>
 /// <param name="poolHeight">The height of the pool area (default is 2)</param>
 /// <param name="stride">Controls the distance between each neighbouring pool areas (default is 2)</param>
 /// <param name="borderMode">Border mode of the max pool operation.
 /// This will set the width and height padding automatically based on the selected border mode: Valid, Same or Full (default is Valid).</param>
 public MaxPool2DLayer(int poolWidth, int poolHeight, int stride = 2, BorderMode borderMode = BorderMode.Valid)
     : this(poolWidth, poolHeight, stride,
            ConvUtils.PaddingFromBorderMode(poolWidth, borderMode),
            ConvUtils.PaddingFromBorderMode(poolHeight, borderMode))
 {
     BorderMode = borderMode;
 }
Пример #2
0
 /// <summary>
 /// 2D Convolutional layer using GEMM implementation
 /// based on: https://petewarden.com/2015/04/20/why-gemm-is-at-the-heart-of-deep-learning/
 /// and: https://arxiv.org/pdf/1410.0759.pdf
 /// </summary>
 /// <param name="filterWidth">The width of the filters</param>
 /// <param name="filterHeight">The height of the filters</param>
 /// <param name="filterCount">The number of filters</param>
 /// <param name="stride">Controls the distance between each neighbouring filter (default is 1)</param>
 /// <param name="borderMode">Border mode of the convolutional operation.
 /// This will set the width and height padding automatically based on the selected border mode: Valid, Same or Full (default is Valid)</param>
 /// <param name="activation">Type of activation function used (default is Relu)</param>
 public Conv2DLayer(int filterWidth, int filterHeight, int filterCount, int stride = 1,
                    BorderMode borderMode = BorderMode.Valid, Activation activation = Activation.Relu)
     : this(filterWidth, filterHeight, filterCount, stride,
            ConvUtils.PaddingFromBorderMode(filterWidth, borderMode),
            ConvUtils.PaddingFromBorderMode(filterHeight, borderMode))
 {
     BorderMode = borderMode;
 }