@tensorflow/tfjs-core
Version:
Hardware-accelerated JavaScript library for machine intelligence
13 lines • 1.09 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var FromPixelsProgram = (function () {
function FromPixelsProgram(outputShape) {
this.variableNames = ['A'];
var height = outputShape[0], width = outputShape[1];
this.outputShape = outputShape;
this.userCode = "\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(" + width + ".0, " + height + ".0);\n\n vec4 values = texture2D(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n ";
}
return FromPixelsProgram;
}());
exports.FromPixelsProgram = FromPixelsProgram;
//# sourceMappingURL=from_pixels_gpu.js.map