# @tensorflow/tfjs-backend-webgl

> GPU accelerated WebGL backend for TensorFlow.js

Latest version **4.22.0** (published 2024-10-21) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @tensorflow/tfjs-backend-webgl
pnpm add @tensorflow/tfjs-backend-webgl
yarn add @tensorflow/tfjs-backend-webgl
bun add @tensorflow/tfjs-backend-webgl
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score; popular repo.

Warnings: low downloads; large bundle.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 4.22.0 |
| Published | 2024-10-21 |
| First published | 2020-04-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 20.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19141 |
| Maintainers | delhibabu, laxma4675, fengwuyao, linchan, pyu10055, caisq, annxingyuan, linazhao128, mattsoulanille, jinjingforever |

## Links

- npm: https://www.npmjs.com/package/@tensorflow/tfjs-backend-webgl
- Repository: https://github.com/tensorflow/tfjs
- Homepage: https://github.com/tensorflow/tfjs#readme
- Issues: https://github.com/tensorflow/tfjs/issues
- npm.io page: https://npm.io/package/@tensorflow/tfjs-backend-webgl

## Dependencies (4)

- [seedrandom](https://npm.io/package/seedrandom.md) ^3.0.5
- [@types/seedrandom](https://npm.io/package/@types/seedrandom.md) ^2.4.28
- [@types/offscreencanvas](https://npm.io/package/@types/offscreencanvas.md) ~2019.3.0
- [@tensorflow/tfjs-backend-cpu](https://npm.io/package/@tensorflow/tfjs-backend-cpu.md) 4.22.0

## Recent versions

- 4.22.0 (latest) — 2024-10-21
- 4.23.0-rc.0 (next) — 2025-01-08
- 4.22.0-rc.0 — 2024-10-14
- 4.21.0 — 2024-09-03
- 4.21.0-rc.0 — 2024-08-26
- 4.20.0 — 2024-06-03
- 4.20.0-rc.0 — 2024-05-28
- 4.19.0 — 2024-04-30
- 4.19.0-rc.0 — 2024-04-24
- 4.18.0 — 2024-04-17
- 4.18.0-rc.0 — 2024-04-11
- 4.17.0 — 2024-01-30
- 4.17.0-rc.0 — 2024-01-23
- 4.16.0 — 2024-01-11
- 4.16.0-rc.0 — 2024-01-09
- … 63 more at https://npm.io/package/@tensorflow/tfjs-backend-webgl/versions

## README

# 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

```js
// 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

```html
<!-- 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

```html
<!-- 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>
```

---
_Source: https://npm.io/package/@tensorflow/tfjs-backend-webgl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
