set webgpu optimized flags

pull/356/head
Vladimir Mandic 2021-10-11 09:22:39 -04:00
parent 7e7cba2168
commit 224f3d26c0
3 changed files with 8 additions and 7 deletions

View File

@ -11,9 +11,8 @@
### **HEAD -> main** 2021/10/10 mandic00@live.com ### **HEAD -> main** 2021/10/10 mandic00@live.com
- image processing fixes
### **origin/main** 2021/10/08 mandic00@live.com - redesign body and hand caching and interpolation
- demo default config cleanup - demo default config cleanup
- improve gaze and face angle visualizations in draw - improve gaze and face angle visualizations in draw

View File

@ -165,9 +165,9 @@ export function process(input: Input, config: Config, getTensor: boolean = true)
pixels = tf.browser ? tf.browser.fromPixels(input) : null; pixels = tf.browser ? tf.browser.fromPixels(input) : null;
} else { } else {
depth = input['data'].length / input['height'] / input['width']; depth = input['data'].length / input['height'] / input['width'];
const arr = Uint8Array.from(input['data']); // const arr = Uint8Array.from(input['data']);
// const arr = new Uint8Array(input['data']['buffer']); const arr = new Uint8Array(input['data']['buffer']);
pixels = tf.tensor(arr, [input['height'], input['width'], depth], 'float32'); pixels = tf.tensor(arr, [input['height'], input['width'], depth], 'int32');
} }
} else { } else {
if (!tmpCanvas || (outCanvas.width !== tmpCanvas.width) || (outCanvas?.height !== tmpCanvas?.height)) tmpCanvas = canvas(outCanvas.width, outCanvas.height); // init output canvas if (!tmpCanvas || (outCanvas.width !== tmpCanvas.width) || (outCanvas?.height !== tmpCanvas?.height)) tmpCanvas = canvas(outCanvas.width, outCanvas.height); // init output canvas

View File

@ -91,7 +91,9 @@ export async function check(instance, force = false) {
// customize webgpu // customize webgpu
if (tf.getBackend() === 'webgpu') { if (tf.getBackend() === 'webgpu') {
tf.ENV.set('WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD', 256); tf.ENV.set('WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD', 512);
tf.ENV.set('WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE', 0);
tf.ENV.set('WEBGPU_CPU_FORWARD', true);
} }
// wait for ready // wait for ready