mirror of https://github.com/tracel-ai/burn.git
Fix guide project name in the book (#1631)
This commit is contained in:
parent
1235b06e25
commit
0ee2021567
|
@ -28,9 +28,7 @@ fn main() {
|
||||||
You might be wondering why we use the `guide` prefix to bring the different modules we just
|
You might be wondering why we use the `guide` prefix to bring the different modules we just
|
||||||
implemented into scope. Instead of including the code in the current guide in a single file, we
|
implemented into scope. Instead of including the code in the current guide in a single file, we
|
||||||
separated it into different files which group related code into _modules_. The `guide` is simply the
|
separated it into different files which group related code into _modules_. The `guide` is simply the
|
||||||
name we gave to our _crate_, which contains the different files. If you named your project crate
|
name we gave to our _crate_, which contains the different files. Below is a brief explanation of the
|
||||||
as `my-first-burn-model`,
|
|
||||||
you can equivalently replace all usages of `guide` above with `my-first-burn-model`. Below is a brief explanation of the
|
|
||||||
different parts of the Rust module system.
|
different parts of the Rust module system.
|
||||||
|
|
||||||
A **package** is a bundle of one or more crates that provides a set of functionality. A package
|
A **package** is a bundle of one or more crates that provides a set of functionality. A package
|
||||||
|
@ -40,9 +38,9 @@ A **crate** is a compilation unit in Rust. It could be a single file, but it is
|
||||||
split up crates into multiple _modules_ and possibly multiple files. A crate can come in one of two
|
split up crates into multiple _modules_ and possibly multiple files. A crate can come in one of two
|
||||||
forms: a binary crate or a library crate. When compiling a crate, the compiler first looks in the
|
forms: a binary crate or a library crate. When compiling a crate, the compiler first looks in the
|
||||||
crate root file (usually `src/lib.rs` for a library crate or `src/main.rs` for a binary crate). Any
|
crate root file (usually `src/lib.rs` for a library crate or `src/main.rs` for a binary crate). Any
|
||||||
module declared in the crate root file will be inserted in the crate for compilation. For this demo example, we will
|
module declared in the crate root file will be inserted in the crate for compilation. For this demo
|
||||||
define a library crate where all the individual modules (model, data, training, etc.) are listed inside `src/lib.rs` as
|
example, we will define a library crate where all the individual modules (model, data, training,
|
||||||
follows:
|
etc.) are listed inside `src/lib.rs` as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
pub mod data;
|
pub mod data;
|
||||||
|
@ -52,11 +50,11 @@ pub mod training;
|
||||||
```
|
```
|
||||||
|
|
||||||
A **module** lets us organize code within a crate for readability and easy reuse. Modules also allow
|
A **module** lets us organize code within a crate for readability and easy reuse. Modules also allow
|
||||||
us to control the _privacy_ of items. The `pub` keyword used above, for example, is employed to make a module publicly
|
us to control the _privacy_ of items. The `pub` keyword used above, for example, is employed to make
|
||||||
available inside the crate.
|
a module publicly available inside the crate.
|
||||||
|
|
||||||
The entry point of our program is the `main` function, defined in the `examples/guide.rs` file. The file structure
|
The entry point of our program is the `main` function, defined in the `examples/guide.rs` file. The
|
||||||
for this example is illustrated below:
|
file structure for this example is illustrated below:
|
||||||
|
|
||||||
```
|
```
|
||||||
guide
|
guide
|
||||||
|
@ -72,8 +70,8 @@ guide
|
||||||
```
|
```
|
||||||
|
|
||||||
The source for this guide can be found in our
|
The source for this guide can be found in our
|
||||||
[GitHub repository](https://github.com/tracel-ai/burn/tree/main/examples/guide) which can be used to run this basic
|
[GitHub repository](https://github.com/tracel-ai/burn/tree/main/examples/guide) which can be used to
|
||||||
workflow example end-to-end.\
|
run this basic workflow example end-to-end.\
|
||||||
|
|
||||||
</details><br>
|
</details><br>
|
||||||
|
|
||||||
|
|
|
@ -4,17 +4,17 @@ The first step is to create a project and add the different Burn dependencies. S
|
||||||
new project with Cargo:
|
new project with Cargo:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
cargo new my-first-burn-model
|
cargo new guide
|
||||||
```
|
```
|
||||||
|
|
||||||
As [mentioned previously](../getting-started.md#creating-a-burn-application), this will initialize
|
As [mentioned previously](../getting-started.md#creating-a-burn-application), this will initialize
|
||||||
your `my-first-burn-model` project directory with a `Cargo.toml` and a `src/main.rs` file.
|
your `guide` project directory with a `Cargo.toml` and a `src/main.rs` file.
|
||||||
|
|
||||||
In the `Cargo.toml` file, add the `burn` dependency with `train`, `wgpu` and `vision` features.
|
In the `Cargo.toml` file, add the `burn` dependency with `train`, `wgpu` and `vision` features.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[package]
|
[package]
|
||||||
name = "my-first-burn-model"
|
name = "guide"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
@ -279,9 +279,10 @@ network modules already built with Burn use the `forward` nomenclature, simply b
|
||||||
standard in the field.
|
standard in the field.
|
||||||
|
|
||||||
Similar to neural network modules, the [`Tensor`](../building-blocks/tensor.md) struct given as a
|
Similar to neural network modules, the [`Tensor`](../building-blocks/tensor.md) struct given as a
|
||||||
parameter also takes the Backend trait as a generic argument, alongside its dimensionality. Even if it is not
|
parameter also takes the Backend trait as a generic argument, alongside its dimensionality. Even if
|
||||||
used in this specific example, it is possible to add the kind of the tensor as a third generic
|
it is not used in this specific example, it is possible to add the kind of the tensor as a third
|
||||||
argument. For example, a 3-dimensional Tensor of different data types(float, int, bool) would be defined as following:
|
generic argument. For example, a 3-dimensional Tensor of different data types(float, int, bool)
|
||||||
|
would be defined as following:
|
||||||
|
|
||||||
```rust , ignore
|
```rust , ignore
|
||||||
Tensor<B, 3> // Float tensor (default)
|
Tensor<B, 3> // Float tensor (default)
|
||||||
|
|
Loading…
Reference in New Issue