pulsatrix
Loading...
Searching...
No Matches
pulsatrix::Saliency Class Reference

Raw-gradient saliency: d(output[target_index])/d(input), computed by seeding ExplainerContext::backward_pass with a one-hot vector at target_index. More...

#include <saliency.hpp>

Public Member Functions

Attribution explain (ExplainerContext &ctx, const Tensor &input, int64_t target_index, DeviceBackend *backend) const
 Computes the saliency map for one output index.
 

Detailed Description

Raw-gradient saliency: d(output[target_index])/d(input), computed by seeding ExplainerContext::backward_pass with a one-hot vector at target_index.

Note
A pure graph walker built entirely against ExplainerContext's public interface – no core (Tensor/ComputationGraph/Autograd/Module) changes needed, per the charter's own red-flag check for explainer additions.
Device-generic: forward/backward run on the network's device; only the one-hot seed is built on the host and uploaded beside the output (explainer_detail host boundary).

Member Function Documentation

◆ explain()

Attribution pulsatrix::Saliency::explain ( ExplainerContext &  ctx,
const Tensor &  input,
int64_t  target_index,
DeviceBackend *  backend 
) const
inline

Computes the saliency map for one output index.

Parameters
ctxContext to run the forward/backward pass through.
inputInput to explain.
target_indexWhich output element's gradient to compute (0-based, flat index into the network's output).
backendBackend to allocate the one-hot seed tensor through (the output's own backend is used instead when this one serves a different device).
Returns
An Attribution with method "saliency", values = the input gradient, and metadata recording the target index used.
Note
Assumes a rank-2 (N, num_classes) network output – migrated by campaign_exai_dl_library_batch_dimension_support from the original rank-1 assumption. target_index selects the same class for every example in the batch (seeding a one-hot at [n, target_index] for every row n), not a per-example target vector – a deliberate scope boundary (this migration fixes the shape contract, it doesn't add per-example target selection as a new capability).

The documentation for this class was generated from the following file: