tfjs/tfjs-backend-webgl
Matthew Soulanille 78345c5f33
Move PR Continuous Integration to Github Actions (#8534)
Move GCP presubmits to Github actions. This allows us to run WebGL / WebGPU tests, since Github Actions have a MacOS runner with a GPU. This should unblock several PRs.
2025-04-23 10:55:01 -07:00
..
src add flag (#7934) 2023-08-28 20:26:18 +00:00
.npmignore
.npmrc
BUILD.bazel Move PR Continuous Integration to Github Actions (#8534) 2025-04-23 10:55:01 -07:00
README.md
package.json Update TypeScript to 5.0.4 (#7681) 2023-07-21 14:55:05 -07:00
tsconfig.json
yarn.lock

README.md

Usage

This package implements a GPU accelerated WebGL backend for TensorFlow.js.

Importing the backend

Note: this backend is included by default in @tensorflow/tfjs.

Via NPM

// Import @tensorflow/tfjs-core
import * as tf from '@tensorflow/tfjs-core';
// Adds the WebGL backend to the global backend registry.
import '@tensorflow/tfjs-backend-webgl';

Via a script tag

<!-- Import @tensorflow/tfjs-core -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>

<!-- Adds the WebGL backend to the global backend registry -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl"></script>

You can also get ES2017 code using the following links

<!-- Import @tensorflow/tfjs-core -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core@2.0.0-rc.4/dist/tf-core.es2017.js"></script>

<!-- Adds the WebGL backend to the global backend registry -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl@2.0.0-rc.4/dist/tf-backend-webgl.es2017.js"></script>