示例#1
0
        public override MultiMatrix getGradientInput(MultiMatrix inData, MultiMatrix nextGradient)
        {
            var gradientIn = MultiMatrix.Build.repeat(inData.Dimensions, 0);

            foreach (var coords in nextGradient.AllCoords())
            {
                foreach (var offset in Weights.AllCoords())
                {
                    gradientIn.addAt(coords.add(offset), nextGradient.at(coords) * Weights.at(offset));
                }
            }
            return(gradientIn);
        }
示例#2
0
        public double getSumAt(MultiMatrix inData, int[] coord)
        {
            var sum = 0.0;

            foreach (var offset in this.weights.AllCoords())
            {
                var nearbyCoord = coord.add(offset);
                if (inData.areValidCoords(nearbyCoord))
                {
                    sum += inData.at(coord.add(offset)) * weights.at(offset);
                }
            }
            return(sum);
        }
示例#3
0
        }// TODO check ?

        public MultiMatrix getGradientWeights(MultiMatrix inData, MultiMatrix nextGradient)
        {
            var gradientW = new MultiMatrix(this.Dimensions);

            foreach (var coord in nextGradient.AllCoords())
            {
                foreach (var offset in this.weights.AllCoords())
                {
                    var nearbyCoord = coord.add(offset);
                    gradientW.addAt(offset, nextGradient.at(coord) * inData.at(nearbyCoord));
                }
            }
            return(gradientW);
        }