Skip to content

Commit

Permalink
Make slice2d internal use makeOutputArray. (tensorflow#124)
Browse files Browse the repository at this point in the history
* slice 2d => makeOutputArray
  • Loading branch information
Nikhil Thorat authored Sep 12, 2017
1 parent a7e64c6 commit 51c47eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/watch-demo
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let httpServerStarted = false;

console.log('Waiting for initial compile...');
watchify.stderr.on('data', (data) => {
if (data.toString().includes(`written to ${path.dirname(startTsFilePath)}`)) {
if (data.toString().includes(`bytes written to`)) {
if (!httpServerStarted) {
const httpCmd = path.join('node_modules', '.bin', 'http-server');
const httpServer = spawn(httpCmd, ['-c-1'], { detached: false});
Expand Down
7 changes: 2 additions & 5 deletions src/math/math_gpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class NDArrayMathGPU extends NDArrayMath {
// Pretend the source was in logical shape that matches the texture shape.
const source = ndarray.as2D(texShape[0], texShape[1]);
// Do the same for output.
const output = this.makeOutputArray(texShape) as Array2D;
const output = this.makeOutputArray<Array2D>(texShape);
this.copy2D(source, [0, 0], texShape, output, [0, 0], texShape);
// Get back to the original logical shape.
return output.reshape(ndarray.shape);
Expand All @@ -84,10 +84,7 @@ export class NDArrayMathGPU extends NDArrayMath {
protected slice2DInternal(
input: Array2D, beginRowCol: [number, number],
sizeRowCol: [number, number]): Array2D {
const result = NDArray.make<Array2D>(sizeRowCol, {
texture: this.textureManager.acquireTexture(sizeRowCol),
textureShapeRC: sizeRowCol
});
const result = this.makeOutputArray<Array2D>(sizeRowCol);
this.copy2DInternal(
input, beginRowCol, sizeRowCol, result, [0, 0], sizeRowCol);
return result;
Expand Down

0 comments on commit 51c47eb

Please sign in to comment.