From 65da240637c166eec229fe72bf359b3f00890b94 Mon Sep 17 00:00:00 2001 From: Zach Carmichael Date: Wed, 11 Jun 2025 12:21:17 -0700 Subject: [PATCH] Preserve template in InterpretableInputs Summary: Preserve template in InterpretableInputs before replacing it with a formatting function. This allows original template strings to be fetched, if needed. Differential Revision: D76426755 --- captum/attr/_utils/interpretable_input.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/captum/attr/_utils/interpretable_input.py b/captum/attr/_utils/interpretable_input.py index 3d5f0566f2..5ee9479768 100644 --- a/captum/attr/_utils/interpretable_input.py +++ b/captum/attr/_utils/interpretable_input.py @@ -286,6 +286,8 @@ def __init__( self.n_features = n_features self.n_itp_features = n_itp_features + # preserve template before modification + self.template = template if isinstance(template, str): template = template.format else: