Skip to main content

Crate burn_derive

Crate burn_derive 

Source
Expand description

Derive and procedural macros for Burn.

Use these through burn, which re-exports them; this crate is not meant to be a direct dependency.

  • #[derive(Module)] implements Module for a struct or enum of modules, parameters and constants. #[module(skip)] excludes a field.
  • #[derive(Config)] makes a struct a serializable configuration with a generated new constructor and with_* setters for optional fields and fields marked #[config(default = ...)].
  • #[derive(RecordState)] decomposes an optimizer or scheduler state into named tensors and scalars for the burnpack format.

The function-like macros below implement burn::tensor::assert_shape!, debug_assert_shape! and einsum!, and are not part of the public API.

Derive Macrosยง

Config
Derive macro for the config.
Module
Derive macro for the Module trait.
RecordState
Derive macro for a recordable state (optimizer or learning-rate scheduler), decomposing it into named tensors and scalars for the burnpack format.