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>
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).
◆ capabilities()
◆ explain()
Computes the saliency map for one output index.
- Parameters
-
| ctx | Context to run the forward/backward pass through. |
| input | Input to explain. |
| target_index | Which output element's gradient to compute (0-based, flat index into the network's output). |
| backend | Backend 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: