Skip to content

Commit

Permalink
Fix import and type redefinitions in mnist example crate (tracel-ai#1100
Browse files Browse the repository at this point in the history
)

* Remove the double import for WgpuDevice
* Prioritize wgpu backend over the default ndarray when wgpu feature is set

This fixes `cargo bench --festures wgpu` as `--no-default-features` cannot be
used.
  • Loading branch information
syl20bnr authored Jan 2, 2024
1 parent 40ec289 commit a4de93a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions examples/mnist-inference-web/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use crate::model::Model;
#[cfg(feature = "wgpu")]
use burn::backend::wgpu::WgpuDevice;
use burn::module::Module;
use burn::record::BinBytesRecorder;
use burn::record::FullPrecisionSettings;
Expand All @@ -12,7 +10,7 @@ use burn::backend::wgpu::{compute::init_async, AutoGraphicsApi, Wgpu, WgpuDevice
#[cfg(feature = "wgpu")]
pub type Backend = Wgpu<AutoGraphicsApi, f32, i32>;

#[cfg(feature = "ndarray")]
#[cfg(all(feature = "ndarray", not(feature = "wgpu")))]
pub type Backend = burn::backend::ndarray::NdArray<f32>;

static STATE_ENCODED: &[u8] = include_bytes!("../model.bin");
Expand Down

0 comments on commit a4de93a

Please sign in to comment.