

2. Create a Rust application
- Open your preferred terminal or command prompt.
- Use Cargo, Rust's package manager, to create a new Burn application in a specific directory.
- Change your current directory to the newly created project.

3. Add the Burn dependency and choose a backend
- Cargo simplifies the process of including external libraries. The following command adds the main dependency and specifies the [wgpu] backend.

4. Start developing with Burn
- With Burn successfully installed, you're now ready to start developing your deep learning projects using this powerful framework.

Basic example
1. Now open [src/main.rs] and replace its content with:
use burn::tensor::{Device, Tensor};
fn main() {
// Run on any device: Device::{wgpu, cuda, rocm, metal, vulkan, flex, cpu}
let device = Device::wgpu(Default::default());
let tensor1 = Tensor::<2>::from_data([[2., 3.], [4., 5.]], &device);
let tensor2 = Tensor::<2>::ones_like(&tensor1);
// Print the element-wise addition of the two tensors.
println!("{}", tensor1 + tensor2);
}
2. Run Cargo
3. You should now see the result of the addition:
Tensor {
data:
[[3.0, 4.0],
[5.0, 6.0]],
shape: [2, 2],
device: Device<Cube(Wgpu(WgpuDevice { kind: DefaultDevice, backend: Auto }))>,
kind: "Float",
dtype: "f32",
}
While this example is somewhat trivial, the basic workflow section of the Burn Book will walk you through a much more relevant example for deep learning applications.
