4.19.0 • Published 10 days ago

@tensorflow/tfjs-backend-webgpu v4.19.0

Weekly downloads
13
License
Apache-2.0
Repository
github
Last release
10 days ago

Usage

This package adds a GPU accelerated WebGPU backend to TensorFlow.js. It currently supports the following models:

  • BlazeFace
  • BodyPix
  • Face landmarks detection
  • HandPose
  • MobileNet
  • PoseDetection
  • Universal sentence encoder
  • AutoML Image classification
  • AutoML Object detection
  • Speech commands

Google Chrome started to support WebGPU by default in M113 on May 2, 2023.

Importing the backend

Via NPM

// Import @tensorflow/tfjs or @tensorflow/tfjs-core
import * as tf from '@tensorflow/tfjs';
// Add the WebGPU backend to the global backend registry.
import '@tensorflow/tfjs-backend-webgpu';
// Set the backend to WebGPU and wait for the module to be ready.
tf.setBackend('webgpu').then(() => main());

Via a script tag

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

<!-- Add the WebGPU backend to the global backend registry -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgpu/dist/tf-backend-webgpu.js"></script>
<script>
// Set the backend to WebGPU and wait for the module to be ready
tf.setBackend('webgpu').then(() => main());
</script>

FAQ

When should I use the WebGPU backend?

The mission of WebGPU backend is to achieve the best performance among all approaches. However, this target can not be met overnight, but we are committed to supporting it with rapid and continuous performance improvement. Many exciting features, like FP16, DP4A, will be brought in soon.

How many ops have you implemented?

See register_all_kernels.ts for an up-to-date list of supported ops. We love contributions. See the contributing document for more info.

Do you support training?

Maybe. There are still a decent number of ops that we are missing in WebGPU that are needed for gradient computation. At this point we are focused on making inference as fast as possible.

Do you work in node?

Yes. If you run into issues, please let us know.

How do I give feedback?

We'd love your feedback as we develop this backend! Please file an issue here.

Development

Building

yarn build

Testing

Currently the Canary channel of Chrome is used for testing of the WebGPU backend:

yarn test  # --test_env=CHROME_CANARY_BIN=/path/to/chrome
4.19.0

10 days ago

4.19.0-rc.0

16 days ago

4.18.0

23 days ago

4.18.0-rc.0

29 days ago

4.17.0

3 months ago

4.17.0-rc.0

4 months ago

4.16.0

4 months ago

4.16.0-rc.0

4 months ago

4.15.0

5 months ago

4.15.0-rc.0

5 months ago

4.14.0

5 months ago

4.9.0

10 months ago

4.14.0-rc.0

6 months ago

4.12.0-rc.0

7 months ago

4.13.0-rc.0

6 months ago

4.11.0

8 months ago

4.12.0

7 months ago

4.13.0

6 months ago

4.10.0

9 months ago

4.8.0

11 months ago

4.7.0

11 months ago

0.0.1-alpha.20

1 year ago

4.6.0

12 months ago

0.0.1-alpha.18

1 year ago

0.0.1-alpha.19

1 year ago

0.0.1-alpha.17

1 year ago

0.0.1-alpha.14

2 years ago

0.0.1-alpha.16

1 year ago

0.0.1-alpha.13

2 years ago

0.0.1-alpha.12

2 years ago

0.0.1-alpha.11

2 years ago

0.0.1-alpha.10

2 years ago

0.0.1-alpha.9

2 years ago

0.0.1-alpha.8

3 years ago

0.0.1-alpha.6

3 years ago

0.0.1-alpha.7

3 years ago

0.0.1-alpha.5

3 years ago

0.0.1-alpha.4

4 years ago

0.0.1-alpha.3

5 years ago

0.0.1-alpha.2

5 years ago

0.0.1-alpha.1

5 years ago

0.0.1-alpha.0

5 years ago