1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//! Neural network layers: the layer subsystem aggregator
//!
//! Declares every layer submodule and glob-re-exports the public layer types. It also defines
//! the shared infrastructure used across the subsystem: the
//! [`TrainingParameters`](crate::neural_network::layers::TrainingParameters) classification (a
//! layer is `Trainable`, `NonTrainable`, or `NoTrainable`), and the
//! `no_trainable_parameters_layer_functions` macro. That macro emits the `param_count` and
//! `get_weights` stubs for parameter-free layers.
//!
//! The submodules fall into a few categories:
//!
//! - Core layers (re-exported):
//! - [`activation`](crate::neural_network::layers::activation)
//! - [`border`](crate::neural_network::layers::border)
//! - [`convolution`](crate::neural_network::layers::convolution)
//! - [`dense`](crate::neural_network::layers::dense)
//! - [`embedding`](crate::neural_network::layers::embedding)
//! - [`flatten`](crate::neural_network::layers::flatten)
//! - [`identity`](crate::neural_network::layers::identity)
//! - [`permute`](crate::neural_network::layers::permute)
//! - [`pooling`](crate::neural_network::layers::pooling)
//! - [`recurrent`](crate::neural_network::layers::recurrent)
//! - [`regularization`](crate::neural_network::layers::regularization)
//! - [`repeat_vector`](crate::neural_network::layers::repeat_vector)
//! - [`reshape`](crate::neural_network::layers::reshape)
//! - [`upsampling`](crate::neural_network::layers::upsampling)
//! - Weight containers: [`layer_weight`](crate::neural_network::layers::layer_weight)
//! - Shared (private) helpers: `conv_op_helpers` (2D/4D convolution zero-padding) and
//! `shape_helpers` (pooling/convolution output-shape calculators)
//! - Validation: `validation` (shared input/weight checks)
//! - Serialization: [`serialize_model`](crate::neural_network::layers::serialize_model)
//! (model-level snapshot and load-time weight application)
/// Classifies a layer by its parameter training capability
///
/// Layers fall into 3 groups. Some have trainable parameters, such as Dense or a convolutional
/// layer. Some have parameters, but they are frozen. Others have no parameters at all, such as
/// a pooling or activation layer
/// A module containing activation layer implementations for neural networks
/// Zero-padding and cropping layers that resize the spatial axes at their ends
/// Convolution-internal helpers (output assembly, gradient accumulation, padding)
/// Convolutional layer for neural networks
/// Dense (Fully Connected) layer implementation for neural networks
/// A trainable lookup table that turns whole-number indices into dense vectors
/// A layer that flattens a 3D, 4D, or 5D tensor into a 2D tensor
/// A layer that passes its input through unchanged
/// Container for different types of neural network layer weights
/// A layer that reorders the axes after the batch axis
/// Pooling layer for neural networks
/// Recurrent layer for neural networks
/// A module containing regularization layers for neural networks
/// A layer that repeats a feature vector into a sequence
/// A layer that rewrites the axes after the batch axis into a target shape
/// Model-level serialization scaffolding (whole-model snapshot and load-time weight application)
/// Output-shape calculators for pooling and convolution layers
/// Upsampling layers that enlarge the spatial axes by a whole-number factor
/// Shared input/weight validation for the layer module
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
/// Generates the trait method stubs for layers without trainable parameters
///
/// Such layers rely on the default [`Layer::parameters`] (an empty list, so the optimizer
/// skips them). This macro supplies the remaining required `param_count` and `get_weights`
/// methods
///
/// It is path-exported via a `pub(in ...) use` re-export, so callers import it explicitly
/// rather than depending on textual macro ordering:
/// `use crate::neural_network::layers::no_trainable_parameters_layer_functions;`
///
/// The generated `param_count` returns `TrainingParameters::NoTrainable`, and `get_weights`
/// returns `LayerWeight::Empty`
pub use no_trainable_parameters_layer_functions;