예제 #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 FeatureMap(FeatureMapProps props)
        {
            Props      = props;
            Weights    = new float[props.NeighborhoodCols * props.neighborhoodRows + 1];
            OldWeights = new float[Weights.Length];

            Features = new float[props.FeatureRows][];
            for (int i = 0; i < Features.Length; i++)
            {
                Features[i] = new float[props.FeatureCols];
            }
        }