contributor-book/src/guides/submitting-examples.md
This guide explains how to create and submit new examples to the Burn repository. Examples are a great way to demonstrate Burn's capabilities and help users understand how to use the framework effectively.
For a minimal working example, see the simple-regression example in the repository.
The Burn repository is set up as a workspace, with examples located in the examples/ directory. Each example is a separate crate that can reuse workspace dependencies.
Navigate to the examples directory:
cd examples
Create a new library crate:
cargo new --lib <my-example>
Update the example's Cargo.toml:
[package]
name = "<my-example>"
version = "0.1.0"
edition = "2021"
readme = "README.md"
# Remove this line if it exists
# readme.workspace = true
[dependencies]
# Reuse workspace dependencies when available
serde = { workspace = true }
# Add example-specific dependencies
burn = { path = "../../" }
Each example must include a README.md file with:
Example README structure:
# Example Name
Brief description of what this example demonstrates.
## Running the Example
```bash
cargo run --example <my-example>
```
## Prerequisites
List any prerequisites here.
src/ directory: Contains the main implementation codeexamples/ directory: Contains example code
<my-example>.rs: Example implementationCode Organization
Error Handling
Performance
Documentation
Feel free to ask questions in the pull request if you need clarification or guidance.