|
pulsatrix
|
y = max(x, 0), elementwise. No parameters, no parameter gradients. More...
#include <relu_module.hpp>


Public Member Functions | |
| ReluModule (DeviceBackend *backend, DeviceType device) | |
| Constructs a ReLU module. | |
| ReluModule (DeviceBackend *backend) | |
| As above, on backend's own device (backend->device()). | |
| Tensor | backward (const Tensor &grad_output) override |
| Computes the gradient w.r.t. this module's input. | |
| OpType | op_type () const override |
| Activation per charter's closed OpType set. | |
| Tensor | propagate_relevance (const Tensor &relevance_out, const LRPRuleConfig &config) override |
| Pass-through LRP relevance propagation. | |
| bool | supports_lrp_rule (LRPRule) const override |
| Pass-through relevance is the same under every rule: supports all of them. | |
| std::optional< DeviceType > | compute_device () const override |
| Where this layer computes, so forward() rejects an input on another device (FND-8). | |
Public Member Functions inherited from pulsatrix::Module | |
| 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< NamedParamRef > | named_parameters () |
| This module's trainable parameters, each with its hierarchical name – the one place a module declares its parameters (roadmap FND-1). | |
| 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. | |
Protected Member Functions | |
| Tensor | forward_impl (const Tensor &input) override |
| The actual forward computation. Called by forward() after precondition checks. | |
y = max(x, 0), elementwise. No parameters, no parameter gradients.
| pulsatrix::ReluModule::ReluModule | ( | DeviceBackend * | backend, |
| DeviceType | device | ||
| ) |
Constructs a ReLU module.
| backend | Backend to compute through. Not owned; must outlive this module. |
| device | Which device last_input_ is initially tagged as. forward_impl()'s output is tagged with the actual input tensor's device on every call (not this constructor argument), since ReLU has no parameters of its own to anchor a fixed "module device" the way LinearModule's weight_ does – see campaign_exai_dl_library_phase1_5_cuda_backend.md's Mission 3. |
|
explicit |
As above, on backend's own device (backend->device()).
Computes the gradient w.r.t. this module's input.
| grad_output | Gradient w.r.t. this module's output. Must match the shape of the most recent forward() call's output. |
Implements pulsatrix::Module.
|
inlineoverridevirtual |
Where this layer computes, so forward() rejects an input on another device (FND-8).
Reimplemented from pulsatrix::Module.
The actual forward computation. Called by forward() after precondition checks.
Implements pulsatrix::Module.
|
inlineoverridevirtual |
Activation per charter's closed OpType set.
Implements pulsatrix::Module.
|
overridevirtual |
Pass-through LRP relevance propagation.
Implements pulsatrix::Module.
|
inlineoverridevirtual |
Pass-through relevance is the same under every rule: supports all of them.
Reimplemented from pulsatrix::Module.