function whereImpl(condShape, condVals) {
    const indices = [];
    for(let i = 0; i < condVals.length; i++)if (condVals[i]) indices.push(i);
    const inBuffer = (0, _buffer.buffer)(condShape, "int32");
    const out = (0, _buffer.buffer)([
        indices.length,
        condShape.length
    ], "int32");
    for(let i = 0; i < indices.length; i++){
        const loc = inBuffer.indexToLoc(indices[i]);
        const offset = i * condShape.length;
        out.values.set(loc, offset);
    }
    return out.toTensor();
}
An implementation of the Where kernel shared between cpu and webgl