Last active
October 6, 2018 02:39
-
-
Save robertleeplummerjr/7680d0a3582418066015885f531823cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function compareFilters(filterDeltas, inputs, deltas) { | |
| const startingInputY = this.thread.y - this.constants.paddingY | |
| const startingInputX = this.thread.x - this.constants.paddingX | |
| let deltaSlideY = 0 | |
| let sum = filterDeltas[this.thread.z][this.thread.y][this.thread.x] | |
| for (let y = 0; y < this.constants.slideHeight; y++) { | |
| deltaSlideY++ | |
| let deltaSlideX = 0 | |
| const inputY = startingInputY + (y * this.constants.strideY) | |
| if (inputY < 0 || inputY >= this.constants.inputHeight) continue | |
| for (let x = 0; x < this.constants.slideWidth; x++) { | |
| deltaSlideX++ | |
| const inputX = startingInputX + (x * this.constants.strideX) | |
| if (inputX < 0 || inputX >= this.constants.inputWidth) continue | |
| const input = inputs[this.thread.z][inputY][inputX] | |
| const deltaY = deltaSlideY - 1; | |
| const deltaX = deltaSlideX - 1; | |
| sum += input * deltas[this.constants.deltaZ][deltaY][deltaX] | |
| } | |
| } | |
| return sum | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment