Created
March 26, 2019 17:16
-
-
Save robertleeplummerjr/b97f94db6f94d05d596d2cdc8d8ba297 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
let chunkSize = 15; | |
let inputWidth = 25; | |
let image.dims = { | |
w: 1920, | |
h: 1080 | |
} | |
const myFunc = gpu.createKernel( | |
function(imageTexture, offsetY, offsetX) { | |
return imageTexture[this.thread.y + offsetY][this.thread.x + offsetX]; | |
}, | |
{ output: [inputWidth, inputWidth] } | |
); | |
const chunks = []; | |
const imageTexture = new GPU.Texture(); // pseudo code, needs some inputs values | |
for (let yChunk = 0; yChunk < yChunks; yChunk++) { | |
for (let xChunk = 0; xChunk < xChunks; xChunk++) { | |
chunks.push({ | |
yChunk, | |
xChunk, | |
networkOutput: network.run( | |
myFunc( | |
imageTexture, | |
yChunk * inputWidth, | |
xChunk * inputWidth | |
) | |
).toArray() | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment