7#include <initializer_list>
92 {
"weight", {&weight_, &weight_grad_}},
106 int64_t num_embeddings_;
107 int64_t embedding_dim_;
116 bool has_forwarded_ =
false;
Vendor-agnostic compute/memory backend. CPUBackend, CUDABackend (Phase 1.5), and HIPBackend (Phase 1....
Definition device_backend.hpp:219
Embedding lookup table, rank-2 input (N, L) of float-encoded indices -> rank-3 output (N,...
Definition embedding_module.hpp:39
OpType op_type() const override
Embedding per charter's closed OpType set.
Definition embedding_module.hpp:66
void set_weight(const std::vector< float > &values)
Vector overload for runtime-sized sources – see Tensor's own vector ctor.
Tensor propagate_relevance(const Tensor &relevance_out, const LRPRuleConfig &config) override
Sum-over-embedding-dimension LRP relevance aggregation (Arras et al. 2017).
std::vector< NamedParamRef > named_parameters() override
This module's trainable parameters, each with its hierarchical name – the one place a module declares...
Definition embedding_module.hpp:90
const Tensor & weight() const
Definition embedding_module.hpp:73
Tensor backward(const Tensor &grad_output) override
Scatter-adds grad_output into the corresponding rows of weight_grad_.
void set_weight(std::initializer_list< float > values)
Overwrites the weight buffer – test/initialization use only.
const Tensor & weight_grad() const
Definition embedding_module.hpp:74
EmbeddingModule(int64_t num_embeddings, int64_t embedding_dim, DeviceBackend *backend)
Constructs an embedding table with a zero-initialized weight matrix.
Tensor forward_impl(const Tensor &input) override
The actual forward computation – per-position row copy from weight_.
Base class for every layer type (LinearModule, Conv2DModule, activations, ...).
Definition module.hpp:58
An N-dimensional shape. A plain aggregate of dimensions with no invariant beyond "non-negative dimens...
Definition shape.hpp:24
N-dimensional tensor. Owns its data buffer exclusively; a DeviceBackend* is injected (not owned) – th...
Definition tensor.hpp:29
Abstract base every layer subclasses – NVI forward(), pure-virtual LRP contract.
Definition acquisition_functions.hpp:16
OpType
The op-type tag a Node carries. Charter Part 2 §3: nodes are tagged by a small closed set of op types...
Definition op_type.hpp:19
Configuration for LRP relevance propagation: which rule a module applies and its hyperparameters....
Definition lrp_rule_config.hpp:57