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); }
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); }
}// 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); }