mirror of https://github.com/tracel-ai/burn.git
Demo with wgpu
This commit is contained in:
parent
89eb248b88
commit
1720eb188c
|
@ -15,6 +15,7 @@ default = []
|
|||
[dependencies]
|
||||
burn = {path = "../../burn", default-features = false}
|
||||
burn-ndarray = {path = "../../burn-ndarray", default-features = false}
|
||||
burn-wgpu = {path = "../../burn-wgpu", default-features = false}
|
||||
serde = {workspace = true}
|
||||
wasm-bindgen = "0.2.87"
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ then
|
|||
fi
|
||||
|
||||
# Set optimization flags
|
||||
export RUSTFLAGS="-C lto=fat -C embed-bitcode=yes -C codegen-units=1 -C opt-level=3"
|
||||
export RUSTFLAGS="-C lto=fat -C embed-bitcode=yes -C codegen-units=1 -C opt-level=3 --cfg=web_sys_unstable_apis"
|
||||
|
||||
# Run wasm pack tool to build JS wrapper files and copy wasm to pkg directory.
|
||||
mkdir -p pkg
|
||||
|
|
|
@ -4,8 +4,10 @@ use burn::record::BinBytesRecorder;
|
|||
use burn::record::FullPrecisionSettings;
|
||||
use burn::record::Recorder;
|
||||
use burn_ndarray::NdArrayBackend;
|
||||
use burn_wgpu::WgpuBackend;
|
||||
|
||||
pub type Backend = NdArrayBackend<f32>;
|
||||
pub type Backend = WgpuBackend<burn_wgpu::AutoGraphicsApi, f32, i32>;
|
||||
// pub type Backend = NdArrayBackend<f32>;
|
||||
|
||||
static STATE_ENCODED: &[u8] = include_bytes!("../model.bin");
|
||||
|
||||
|
|
Loading…
Reference in New Issue