2D convolution, batched (input/output are rank-4: N x channels x H x W) – migrated from the original unbatched (rank-3) scope by campaign_exai_dl_library_batch_dimension_support. Stride 1, no padding, no dilation – deferred until a real use case needs them, same pattern as LinearModule's original unbatched scope cut.
More...
|
| | Conv2DModule (int64_t in_channels, int64_t out_channels, int64_t kernel_h, int64_t kernel_w, DeviceBackend *backend, int64_t stride=1, int64_t padding=0) |
| | Constructs a conv layer with zero-initialized kernel/bias.
|
| |
| int64_t | stride () const |
| | Step between windows along both axes.
|
| |
| int64_t | padding () const |
| | Zero padding on every side, along both axes.
|
| |
| Tensor | backward (const Tensor &grad_output) override |
| | Computes gradients w.r.t. input, kernel, and bias.
|
| |
| OpType | op_type () const override |
| | Conv per charter's closed OpType set.
|
| |
| void | set_kernel (std::initializer_list< float > values) |
| | Overwrites the kernel buffer – test/initialization use only.
|
| |
| void | set_bias (std::initializer_list< float > values) |
| | Overwrites the bias buffer – test/initialization use only.
|
| |
| void | set_kernel (const std::vector< float > &values) |
| | Vector overload for runtime-sized sources – see Tensor's own vector ctor.
|
| |
| void | set_bias (const std::vector< float > &values) |
| | Vector overload for runtime-sized sources – see Tensor's own vector ctor.
|
| |
| const Tensor & | kernel () const |
| |
| const Tensor & | bias () const |
| |
| const Tensor & | kernel_grad () const |
| |
| const Tensor & | bias_grad () const |
| |
| Tensor | propagate_relevance (const Tensor &relevance_out, const LRPRuleConfig &config) override |
| | Epsilon-rule LRP relevance propagation.
|
| |
| bool | supports_lrp_rule (LRPRule) const override |
| | Implements every LRPRule.
|
| |
| std::vector< NamedParamRef > | named_parameters () override |
| | This module's trainable parameters, each with its hierarchical name – the one place a module declares its parameters (roadmap FND-1).
|
| |
| std::optional< DeviceType > | compute_device () const override |
| | Where this layer computes, so forward() rejects an input on another device (FND-8).
|
| |
| virtual | ~Module ()=default |
| |
| Tensor | forward (const Tensor &input) |
| | Runs this module's forward computation.
|
| |
| std::pair< Tensor, NodeId > | forward_traced (const Tensor &input, NodeId input_node, ComputationGraph &graph, Autograd &autograd) |
| | Runs forward() while also registering a ComputationGraph node (tagged with this module's op_type(), parented to input_node) and wiring an Autograd backward function that reuses this module's own backward() – the opt-in traced/explainable path, per Phase 2 Mission 0.
|
| |
| virtual std::vector< ParamRef > | parameters () |
| | This module's trainable parameters and their gradients, for an optimizer to update uniformly across module types.
|
| |
| void | set_requires_grad (bool requires_grad, const std::string &prefix="") |
| | Freezes (false) or unfreezes (true) parameters by name (roadmap FND-2).
|
| |
| virtual void | set_training (bool training) |
| | Sets this module's training/eval mode. Defaults to training (matches every mainstream framework's Module default).
|
| |
| bool | is_training () const |
| | Whether this module is currently in training mode.
|
| |
2D convolution, batched (input/output are rank-4: N x channels x H x W) – migrated from the original unbatched (rank-3) scope by campaign_exai_dl_library_batch_dimension_support. Stride 1, no padding, no dilation – deferred until a real use case needs them, same pattern as LinearModule's original unbatched scope cut.
- Note
- Implemented via im2col + gemm per campaign Decision 3 (see campaign_exai_dl_library_phase1_core_layers_training.md) rather than a dedicated DeviceBackend::conv2d primitive – Phase 1.5's cuDNN integration will need its own conv path anyway, so a CPU-side primitive now would likely be thrown away, not reused.
-
Batching implemented as a per-example loop over the existing unbatched im2col/gemm/ col2im pipeline (each output column of the im2col matrix is independent of every other, so this is exactly equivalent to a single larger gemm with the Q axis extended to N*Q – the per-example loop is the simpler, correctness-first choice; see campaign recon's noted alternative), not a new backend primitive.