bevy_burn 0.1.0

bevy burn wgpu compute nodes
docs.rs failed to build bevy_burn-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

bevy_burn

test GitHub License GitHub Last Commit GitHub Releases GitHub Issues Average time to resolve an issue crates.io

bevy burn async compute nodes. write compute shaders in burn with wgpu input and output buffers shared with bevy's render pipeline.

usage

use bevy::prelude::*;
use bevy_burn::{
    BurnInference,
    BurnModel,
    BurnPlugin,
};


fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_plugin(BurnPlugin)
        .add_system(burn_inference)
        .run();
}

fn burn_inference(
    mut commands: Commands,
    burn_inference: Res<BurnInference>,
    input_data: Query<(
        Entity,
        &SomeInput,
        Without<BurnOutput>,
    )>,
    mut model: Local<BurnModel>,
) {
    if model.is_none() {
        *model = burn_inference.model("model.onnx").unwrap();
    }

    for (entity, input) in input_data.iter() {
        let output = model.inference(input).unwrap();

        commands.entity(entity).insert(output);
    }
}