Skip to content

Commit 1dec063

Browse files
authored
PR cleanup from 1827. (tensorflow#1831)
* PR cleanup from 1827. * Don't export GL context.
1 parent 23dd80b commit 1dec063

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

tfjs-backend-nodegl/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
** This project is under heavy development **
44

5-
This new backend will provide a light-weight headless WebGL runtime for TensorFlow.js running under Node.js. This new backend is powered by the [node-gles](https://github.com/google/node-gles) module which uses [ANGLE](https://github.com/google/angle) to provide an integration layer to system GL runtime. This package aims to provide a think acceleration engine for IoT, desktop, and Node.js applications where CUDA (size/OS compatibility) is not an option./
5+
This new backend will provide a light-weight headless WebGL runtime for TensorFlow.js running under Node.js. This new backend is powered by the [node-gles](https://github.com/google/node-gles) module which uses [ANGLE](https://github.com/google/angle) to provide an integration layer to system GL runtime. This package aims to provide a think acceleration engine for IoT, desktop, and Node.js applications where CUDA (size/OS compatibility) is not an option.

tfjs-backend-nodegl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"author": "",
1313
"license": "Apache-2.0",
1414
"dependencies": {
15-
"@tensorflow/tfjs-core": "^1.2.2",
15+
"@tensorflow/tfjs-core": "1.2.2",
1616
"node-gles": "^0.0.13"
1717
},
1818
"devDependencies": {

tfjs-backend-nodegl/src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ tf.ENV.set(
3434
tf.webgl.setWebGLContext(2, nodeGl);
3535

3636
tf.registerBackend('headless-nodegl', () => {
37-
return new tf.webgl.MathBackendWebGL(new tf.webgl.GPGPUContext(gl));
37+
// TODO(kreeger): Consider moving all GL creation here. However, weak-ref to
38+
// GL context tends to cause an issue when running unit tests:
39+
// https://github.com/tensorflow/tfjs/issues/1732
40+
return new tf.webgl.MathBackendWebGL(new tf.webgl.GPGPUContext(nodeGl));
3841
}, 3 /* priority */);
39-
40-
export const gl = nodeGl;

tfjs-backend-nodegl/src/run_tests.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
// We import index.ts so that the Node backend gets registered.
1919
import * as jasmine_util from '@tensorflow/tfjs-core/dist/jasmine_util';
20+
import * as tf from '@tensorflow/tfjs-core';
2021

21-
import * as nodegl from './index';
22+
import './index';
2223

2324
Error.stackTraceLimit = Infinity;
2425

@@ -70,7 +71,8 @@ env.specFilter = spec => {
7071
};
7172

7273
console.log(`Running tests with the following GL info`);
73-
console.log(` GL_VERSION: ${nodegl.gl.getParameter(nodegl.gl.VERSION)}`);
74-
console.log(` GL_RENDERER: ${nodegl.gl.getParameter(nodegl.gl.RENDERER)}`);
74+
const gl = (tf.backend() as tf.webgl.MathBackendWebGL).getGPGPUContext().gl;
75+
console.log(` GL_VERSION: ${gl.getParameter(gl.VERSION)}`);
76+
console.log(` GL_RENDERER: ${gl.getParameter(gl.RENDERER)}`);
7577

7678
runner.execute();

tfjs-backend-nodegl/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# yarn lockfile v1
33

44

5-
"@tensorflow/tfjs-core@^1.2.2":
5+
"@tensorflow/tfjs-core@1.2.2":
66
version "1.2.2"
77
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.2.2.tgz#2efa89e323612a26aeccee9b3ae9f5ac5a635bbe"
88
integrity sha512-2hCHMKjh3UNpLEjbAEaurrTGJyj/KpLtMSAraWgHA1vGY0kmk50BBSbgCDmXWUVm7lyh/SkCq4/GrGDZktEs3g==

0 commit comments

Comments
 (0)