Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tfjs-core/src/backends/webgl/backend_webgl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,10 @@ export class MathBackendWebGL implements KernelBackend {
// Download the values from the GPU.
let vals: Float32Array;
if (dtype === 'complex64') {
const ps =
Promise.all([complexTensors.real.data(), complexTensors.imag.data()]);
const [realValues, imagValues] = await ps;
const ps = await Promise.all(
[complexTensors.real.data(), complexTensors.imag.data()]);
const realValues = ps[0];
const imagValues = ps[1];
vals = mergeRealAndImagArrays(
realValues as Float32Array, imagValues as Float32Array);
} else if (buffer == null) {
Expand Down
4 changes: 2 additions & 2 deletions tfjs-core/src/backends/webgl/conv_backprop_gpu_depthwise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class DepthwiseConv2DDerFilterProgram implements GPGPUProgram {

float dotProd = 0.0;

// TODO: Vec4 over the batch size
// TO DO: Vec4 over the batch size
for (int b = 0; b < ${convInfo.batchSize}; b++) {
for (int yR = 0; yR < ${convInfo.outHeight}; yR++) {
int xR = wR + yR * ${strideHeight} - ${padTop};
Expand Down Expand Up @@ -122,7 +122,7 @@ export class DepthwiseConv2DDerInputProgram implements GPGPUProgram {

int wCPerm = ${filterWidth} - 1 - wC;

// TODO: Vec4 over the channelMul
// TO DO: Vec4 over the channelMul
for (int dm = 0; dm < ${channelMul}; dm++) {
int d2 = d1 * ${channelMul} + dm;
float xValue = getDy(batch, idyR, idyC, d2);
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/backends/webgl/conv_gpu_depthwise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class DepthwiseConv2DProgram implements GPGPUProgram {
// Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0;
// TODO(dsmilkov): Flatten the two for loops and vec4 the operations.
// TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.
for (int wR = 0; wR < ${filterHeight}; wR++) {
int xR = xRCorner + wR * ${dilationHeight};

Expand Down
5 changes: 3 additions & 2 deletions tfjs-core/src/ops/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ export async function toPixels(
const data = await $img.data();
const minTensor = $img.min();
const maxTensor = $img.max();
const [minVals, maxVals] =
await Promise.all([minTensor.data(), maxTensor.data()]);
const vals = await Promise.all([minTensor.data(), maxTensor.data()]);
const minVals = vals[0];
const maxVals = vals[1];
const min = minVals[0];
const max = maxVals[0];
minTensor.dispose();
Expand Down