|
| | ConvolutionalRelu (const Shape &input_shape={3, 3, 1}, const Shape &kernel_shape={3, 3, 1, 1}, const Shape &strides={1, 1}, const string &convolution_type="Valid", const string &label="convolutional_relu_layer") |
| | Constructs a ConvolutionalRelu layer.
|
| |
| Shape | get_input_shape () const override |
| | Returns the per-sample input shape (height, width, channels).
|
| |
| Shape | get_output_shape () const override |
| | Returns the per-sample output shape.
|
| |
| Index | get_output_height () const |
| | Output spatial height after applying stride and padding.
|
| |
| Index | get_output_width () const |
| | Output spatial width after applying stride and padding.
|
| |
| Index | get_input_height () const |
| | Configured input height.
|
| |
| Index | get_input_width () const |
| | Configured input width.
|
| |
| Index | get_input_channels () const |
| | Configured input channel count.
|
| |
| Index | get_kernel_height () const |
| | Kernel height in pixels.
|
| |
| Index | get_kernel_width () const |
| | Kernel width in pixels.
|
| |
| Index | get_kernel_channels () const |
| | Kernel channel count (must equal input channels).
|
| |
| Index | get_kernels_number () const |
| | Number of kernels (output channel count).
|
| |
| Index | get_row_stride () const |
| | Vertical stride in pixels.
|
| |
| Index | get_column_stride () const |
| | Horizontal stride in pixels.
|
| |
| pair< Index, Index > | get_padding () const |
| | Returns padding sizes for the configured convolution type.
|
| |
| Index | get_padding_height () const |
| | Padding rows added on each side.
|
| |
| Index | get_padding_width () const |
| | Padding columns added on each side.
|
| |
| bool | get_use_padding () const |
| | True if padding is applied (i.e. convolution type is not "Valid").
|
| |
| Activation::Function | get_output_activation () const override |
| | Activation function fused at the end of this layer (always ReLU).
|
| |
| vector< Operator * > | get_operators () override |
| | Returns the single operator (Convolution with fused ReLU on GPU).
|
| |
| vector< pair< Shape, Type > > | get_forward_specs (Index batch_size) const override |
| | Specifications of the forward intermediate buffers.
|
| |
| void | set (const Shape &input_shape={0, 0, 0}, const Shape &kernel_shape={3, 3, 1, 1}, const Shape &strides={1, 1}, const string &convolution_type="Valid", const string &label="convolutional_relu_layer") |
| | Re-initializes the layer; same arguments as the constructor.
|
| |
| void | set_input_shape (const Shape &) override |
| | Updates the input shape and re-shapes kernel tensors accordingly.
|
| |
| void | on_compute_dtype_changed () override |
| | Recreates the convolution operator descriptor when the dtype changes.
|
| |
| void | set_row_stride (const Index new_row_stride) |
| | Sets the vertical (row) stride.
|
| |
| void | set_column_stride (const Index new_column_stride) |
| | Sets the horizontal (column) stride.
|
| |
| void | set_convolution_type (const string &) |
| | Sets the padding mode by name.
|
| |
| void | forward_propagate (ForwardPropagation &, size_t, bool) noexcept override |
| | Forward pass: convolution + ReLU fused on GPU, sequential on CPU.
|
| |
| void | back_propagate (ForwardPropagation &, BackPropagation &, size_t) const noexcept override |
| | Backward pass through the fused ReLU and Convolution operators.
|
| |
| void | read_JSON_body (const Json *) override |
| | Reads the layer-specific JSON body (kernel shape, strides, padding) from the given JSON node.
|
| |
| void | write_JSON_body (JsonWriter &) const override |
| | Writes the layer-specific JSON body (kernel shape, strides, padding) to the given JSON writer.
|
| |
| virtual | ~Layer ()=default |
| | Virtual destructor; subclasses are owned via unique_ptr<Layer>.
|
| |
| const string & | get_label () const |
| | Returns the user-assigned label of this layer.
|
| |
| const string & | get_name () const |
| | Returns the canonical type name of this layer.
|
| |
| LayerType | get_type () const |
| | Returns the LayerType enumerator for this layer.
|
| |
| virtual void | set_output_shape (const Shape &) |
| | Sets the per-sample output shape of this layer.
|
| |
| void | set_label (string new_label) |
| | Sets the human-readable label of this layer.
|
| |
| Index | get_parameters_number () const |
| | Total number of trainable parameters in this layer.
|
| |
| virtual vector< pair< Shape, Type > > | get_parameter_specs () const |
| | Specifications of the trainable parameter tensors owned by this layer.
|
| |
| virtual vector< pair< Shape, Type > > | get_state_specs () const |
| | Specifications of the persistent state tensors of this layer.
|
| |
| virtual vector< pair< Shape, Type > > | get_backward_specs (Index batch_size) const |
| | Specifications of the backward intermediate buffers for one batch.
|
| |
| vector< Shape > | get_parameter_shapes () const |
| | Shape-only view of get_parameter_specs().
|
| |
| vector< Shape > | get_state_shapes () const |
| | Shape-only view of get_state_specs().
|
| |
| vector< Shape > | get_forward_shapes (Index b) const |
| | Shape-only view of get_forward_specs() for batch size b.
|
| |
| vector< Shape > | get_backward_shapes (Index b) const |
| | Shape-only view of get_backward_specs() for batch size b.
|
| |
| vector< Type > | get_parameter_dtypes () const |
| | Dtype-only view of get_parameter_specs().
|
| |
| vector< Type > | get_forward_dtypes (Index b) const |
| | Dtype-only view of get_forward_specs() for batch size b.
|
| |
| vector< Type > | get_backward_dtypes (Index b) const |
| | Dtype-only view of get_backward_specs() for batch size b.
|
| |
| Index | get_inputs_number () const |
| | Total number of scalar inputs per sample (product of input dims).
|
| |
| Index | get_outputs_number () const |
| | Total number of scalar outputs per sample (product of output dims).
|
| |
| virtual void | from_JSON (const JsonDocument &document) |
| | Loads the layer configuration (hyperparameters) from JSON.
|
| |
| virtual void | load_state_from_JSON (const JsonDocument &document) |
| | Loads parameter and state tensors from a JSON document.
|
| |
| virtual void | to_JSON (JsonWriter &writer) const |
| | Writes the layer configuration to JSON.
|
| |
| virtual void | print () const |
| | Prints a human-readable summary of the layer to stdout.
|
| |
| bool | get_is_trainable () const |
| | Whether this layer has trainable parameters.
|
| |
| Type | get_compute_dtype () const |
| | Numerical type used for forward/backward computation.
|
| |
| void | set_compute_dtype (Type new_compute_dtype) |
| | Sets the compute dtype and triggers on_compute_dtype_changed().
|
| |
| virtual float * | link_parameters (float *pointer) |
| | Wires this layer's parameter TensorViews onto an external buffer.
|
| |
| virtual float * | link_states (float *pointer) |
| | Wires this layer's state TensorViews onto an external buffer.
|
| |
| vector< TensorView > & | get_parameter_views () |
| | Mutable access to this layer's parameter TensorViews.
|
| |
| const vector< TensorView > & | get_parameter_views () const |
| | Read-only access to this layer's parameter TensorViews.
|
| |
| vector< TensorView > & | get_state_views () |
| | Mutable access to this layer's state TensorViews.
|
| |
| const vector< TensorView > & | get_state_views () const |
| | Read-only access to this layer's state TensorViews.
|
| |
| void | redistribute_parameters_to_operators () |
| | Forwards the current parameter views down to each composing Operator.
|
| |
| void | redistribute_parameter_gradients_to_operators (vector< TensorView > &gradient_views) |
| | Forwards externally provided gradient views down to each Operator.
|
| |
| void | redistribute_states_to_operators () |
| | Forwards the current state views down to each composing Operator.
|
| |
2D convolution + ReLU fused into a single forward op on GPU.
Calls cudnnConvolutionBiasActivationForward with CUDNN_ACTIVATION_RELU. On CPU the activation runs as a separate step. No batch normalization, activation hard-wired to ReLU — keeps forward_propagate() branch-free for CUDA Graph capture.
Use this layer instead of Convolutional when ReLU is the desired activation and the runtime cost of branching matters.