Skip to content

Instantly share code, notes, and snippets.

@GantMan
Created January 9, 2020 18:03
Show Gist options
  • Save GantMan/833cd975b651ec454ba806af0f335fd3 to your computer and use it in GitHub Desktop.
Save GantMan/833cd975b651ec454ba806af0f335fd3 to your computer and use it in GitHub Desktop.
// TensorFlow required
import * as tf from '@tensorflow/tfjs'
import { setWasmPath } from '@tensorflow/tfjs-backend-wasm'
// Default path without setWasmPath is /static/js/tfjs-backend-wasm.wasm
setWasmPath('/tfjs-backend-wasm.wasm')
// We can now force a WASM backend and print it for proof!
tf.setBackend('wasm').then(console.log('The Backend is', tf.getBackend()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment