Comments (5)
from tfjs.
Draw API currently does not have implementation for WebGL backend.
from tfjs.
Thank you for your reply, I was able to complete the objective using WebGPU Kernel! It is almost 100x faster than tf.browser.toPixels() method. Not sure if WebGL will be faster than WebGPU although.
//importing the WebGPUBackend from npm package @tensorflow/tfjs-backend-webgpu
import {WebGPUBackend} from @tensorflow/tfjs-backend-webgpu
//Register the Backend Kernel
if (!navigator.gpu) {
throw new Error("WebGPU not supported on this browser.");
}
const customBackendName = 'custom-webgpu';
const kernels = tf.getKernelsForBackend('webgpu');
kernels.forEach(kernelConfig => {
const newKernelConfig = {...kernelConfig, backendName: customBackendName};
tf.registerKernel(newKernelConfig);
});
const adapter = await navigator.gpu.requestAdapter({powerPreference: 'low-power'});
if (!adapter) {
throw new Error("No appropriate GPUAdapter found.");
}
const device = await adapter.requestDevice();
tf.registerBackend('custom-webgpu', () => new WebGPUBackend(device));
await tf.setBackend('custom-webgpu')
await tf.ready()
const canvas = document.getElementById("imgCanvas2");
const context = canvas.getContext("webgpu");
const canvasFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({
device: device,
format: canvasFormat,
});
//calling Draw API:
tf.browser.draw(<input tensor>,canvas);
@Linchenn Shall I close the issue or keep it?
from tfjs.
WebGPU is typically faster than WebGL, while WebGL has more device coverage.
from tfjs.
Are you satisfied with the resolution of your issue?
Yes
No
from tfjs.
Related Issues (20)
- Can you guide on how to load model (model.json and group1-shard1of1.bin files) which are downloaded to Documents Directory in iOS and internal app storage folder in Android ? HOT 5
- npm install @tensorflow/tfjs-node error HOT 7
- Cannot import TFJS-Node HOT 5
- memory leak (core dumped) problem in tfjs-node HOT 7
- Face Detection not defined HOT 4
- GPU setup guide HOT 4
- @tensorflow/tfjs-react-native can't be installed successfully expo 51 HOT 10
- T5 Text-to-Text Transformer
- React Native Tensorflow with own models not working HOT 3
- webgpu gpu-pipeline example crashes tab HOT 2
- Converting Model Saved by tfjs-react-native to Keras or Saved Model
- Error during training HOT 5
- tf.data.array() cannot consume a Tensor, despite the documentation claiming so HOT 3
- Tensorflowjs for python not working (conflicting libraries) HOT 5
- Getting started example not resilient to growing the training data beyond x=25 HOT 5
- BlazePose doesn't work in Firefox for Android HOT 2
- Problem Converting tensorflow garden model in format of Tensorflow Saved Model to a Web Model with tensorflowjs HOT 4
- Node js doenst recognize the module with node version 20.14 HOT 5
- memory leak (core dumped) problem in tfjs-node HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tfjs.