예제 #1
0
        //TODO figure out batching for a CNN
        public ConvolutionalLayer(ConvolutionalLayerProps props, ActivationFunctions activationFunction, uint batches = 1, bool outputLayer = false)
            : base((uint)props.ConvolutionalOutputs, 0, activationFunction, batches, outputLayer)
        {
            Props        = props;
            InputSegment = new float[props.InputRows][];
            for (int i = 0; i < InputSegment.Length; i++)
            {
                InputSegment[i] = new float[props.InputCols];
            }

            FeatureMapProps featureProps = new FeatureMapProps(props);

            FeatureMaps = new FeatureMap[props.NumberFeatures];
            for (int f = 0; f < FeatureMaps.Length; f++)
            {
                FeatureMaps[f] = new FeatureMap(featureProps);
            }

            MaxPoolProps poolProps = new MaxPoolProps(props);

            MaxPools = new MaxPool[props.NumberFeatures];
            for (int p = 0; p < FeatureMaps.Length; p++)
            {
                MaxPools[p] = new MaxPool(poolProps);
            }
        }
예제 #2
0
 public MaxPool(MaxPoolProps props)
 {
     Pool       = new float[props.PoolRows][];
     IndexPairs = new MaxPoolIndexPair[props.PoolRows][];
     for (int i = 0; i < IndexPairs.Length; i++)
     {
         Pool[i]       = new float[props.PoolCols];
         IndexPairs[i] = new MaxPoolIndexPair[props.PoolCols];
         for (int j = 0; j < IndexPairs[i].Length; j++)
         {
             IndexPairs[i][j] = new MaxPoolIndexPair();
         }
     }
 }