pulsatrix
Loading...
Searching...
No Matches
attribution.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <string>
8#include <unordered_map>
9
11#include "pulsatrix/tensor.hpp"
12
13namespace pulsatrix {
14
25 std::string method;
26
30
32 std::unordered_map<std::string, std::string> metadata;
33};
34
42namespace explainer_detail {
43
49inline DeviceBackend* backend_beside(const Tensor& like, DeviceBackend* backend) {
50 return (backend != nullptr && backend->device() == like.device()) ? backend : like.backend();
51}
52
53} // namespace explainer_detail
54
55} // namespace pulsatrix
Vendor-agnostic compute/memory backend. CPUBackend, CUDABackend (Phase 1.5), and HIPBackend (Phase 1....
Definition device_backend.hpp:219
virtual DeviceType device() const noexcept=0
Which device this backend's buffers reside on.
N-dimensional tensor. Owns its data buffer exclusively; a DeviceBackend* is injected (not owned) – th...
Definition tensor.hpp:29
DeviceType device() const
Which device this tensor's buffer conceptually resides on.
Definition tensor.hpp:122
DeviceBackend * backend() const
The backend that owns this tensor's buffer. Not owned by the Tensor.
Definition tensor.hpp:130
Abstract interface isolating vendor-specific memory/compute operations from Tensor/ComputationGraph.
DeviceBackend * backend_beside(const Tensor &like, DeviceBackend *backend)
The backend to allocate a tensor through that must live beside like.
Definition attribution.hpp:49
Definition acquisition_functions.hpp:16
An explanation result: the raw attribution values, the method that produced them, and any relevant me...
Definition attribution.hpp:23
std::unordered_map< std::string, std::string > metadata
Method-specific metadata (e.g. {"baseline", "zero"} for Integrated Gradients).
Definition attribution.hpp:32
Tensor values
The raw attribution values, same shape as the explained input (or a method-specific shape,...
Definition attribution.hpp:29
std::string method
Which explanation method produced this result (e.g. "saliency", "grad_cam").
Definition attribution.hpp:25
N-dimensional tensor – owns a buffer via DeviceBackend*, RAII (Rule of Five).