Exemple #1
0
 Get2DArray(int cols, int rows)
 {
     double[][] array2D =
         SupportFunctions.Get2DArray(cols,
                                     rows, _maxParallelThreads);
     return(array2D);
 }
Exemple #2
0
 public SingleFilterUnit(LayerBase upStreamLayer,
                         int windowSize,    //FilterSize is always square
                         int strideSize,
                         int maxParallelThreads,
                         double weightBaseValue) : base(upStreamLayer, strideSize, maxParallelThreads)
 {
     //The weight matrix should equal FilterSize
     _weights = SupportFunctions.Get2DArray(windowSize,
                                            windowSize);
     _weightBaseValue = weightBaseValue;
     SetValueMap(windowSize);
 }
Exemple #3
0
        protected void SetValueMap(int noOfInputColumns,
                                   int noOfInputRows,
                                   int windowSize)
        {
            //Computed value will depend on stride size
            int noOfOutputCols = noOfInputColumns;
            int noOfOutputRows = noOfInputRows;

            //For Input Layer ComputedValue/FilterMap values remain the same
            if (windowSize != 0) //If not an input layer
            {
                //Standard formula to determine FilterMap size
                double _temp = ((noOfInputColumns - windowSize)
                                / _stride) + 1;
                if (Math.Round(_temp) != _temp)
                {
                    throw new InvalidStrideValueException();
                }
                else
                {
                    noOfOutputCols = Convert.ToInt32(_temp);
                }

                _temp = ((noOfInputRows - windowSize)
                         / _stride) + 1;
                if (Math.Round(_temp) != _temp)
                {
                    throw new InvalidStrideValueException();
                }
                else
                {
                    noOfOutputRows = Convert.ToInt32(_temp);
                }
            }

            //Set FilterMap Size
            ValueMap = SupportFunctions.Get2DArray(noOfOutputCols,
                                                   noOfOutputRows);
        }