|
pulsatrix
|
y = reshape(x, {N, x.numel()/N}), N = x.shape().dim(0). No parameters, no gradient math beyond reshaping. More...
#include <flatten_module.hpp>


Public Member Functions | |
| FlattenModule (DeviceBackend *backend) | |
| Constructs a flatten module. | |
| Tensor | backward (const Tensor &grad_output) override |
| Reshapes the gradient back to the shape forward() last saw. | |
| OpType | op_type () const override |
| This module's operation-category tag, for ComputationGraph node tagging. | |
| Tensor | propagate_relevance (const Tensor &relevance_out, const LRPRuleConfig &) override |
| Pass-through LRP relevance propagation, reshaped back to the input's shape. | |
| bool | supports_lrp_rule (LRPRule) const override |
| A reshape 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 = reshape(x, {N, x.numel()/N}), N = x.shape().dim(0). No parameters, no gradient math beyond reshaping.
|
inlineexplicit |
Constructs a flatten module.
| backend | Backend to compute through. Not owned; must outlive this module. |
Reshapes the gradient back to the shape forward() last saw.
| grad_output | Gradient w.r.t. this module's (flattened) output. |
Implements pulsatrix::Module.
|
inlineoverridevirtual |
Where this layer computes, so forward() rejects an input on another device (FND-8).
Reimplemented from pulsatrix::Module.
|
inlineoverrideprotectedvirtual |
The actual forward computation. Called by forward() after precondition checks.
Implements pulsatrix::Module.
|
inlineoverridevirtual |
This module's operation-category tag, for ComputationGraph node tagging.
Implements pulsatrix::Module.
|
inlineoverridevirtual |
Pass-through LRP relevance propagation, reshaped back to the input's shape.
Implements pulsatrix::Module.
|
inlineoverridevirtual |
A reshape is the same under every rule: supports all of them.
Reimplemented from pulsatrix::Module.