LiteRT Tensor API WASM Playground
Documentation
Mandelbrot
Game of Life
Gemma 3
Segmentation
Initializing WebAssembly Module...
Code Sandbox
Basic Math
Reductions
Broadcasting
Static Graph
JIT Mode
Eager Mode
// Write JavaScript using the 'litert' WASM module const shape = [2, 2]; const t1 = litert.createTensor({ type: 'FP32', shape: shape, name: 't1' }); const t2 = litert.createTensor({ type: 'FP32', shape: shape, name: 't2' }); const result = t1.add(t2); result.setName("out"); println("Compiling runner and executing graph..."); const runner = await litert.createGraphRunner({"t1": t1, "t2": t2}, {"out": result}); runner.setInputData("t1", [1.0, 2.0, 3.0, 4.0]); runner.setInputData("t2", [10.0, 20.0, 30.0, 40.0]); await runner.run(); logTensor(runner.getOutput("out"), "Addition Result");
Run Sandbox
Execution Console
Console Logs
Tensor Inspector
Run a script to inspect output tensors.