From 7ae6549772f9fd56e2d2978342b122c349a94933 Mon Sep 17 00:00:00 2001 From: EtiMag <55194599+EtiMag@users.noreply.github.com> Date: Thu, 5 Nov 2026 17:18:31 +0100 Subject: [PATCH 1/2] Rectif docstring --- torchTextClassifiers/torchTextClassifiers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchTextClassifiers/torchTextClassifiers.py b/torchTextClassifiers/torchTextClassifiers.py index cc0fdc4..226fe8e 100644 --- a/torchTextClassifiers/torchTextClassifiers.py +++ b/torchTextClassifiers/torchTextClassifiers.py @@ -708,7 +708,7 @@ def predict( explain_with_captum (bool): launch gradient integration with Captum for explanation (default: False) Returns: A dictionary containing the following fields: - - predictions (torch.Tensor, shape (len(text), top_k)): A tensor containing the top_k most likely codes to the query. + - prediction (torch.Tensor, shape (len(text), top_k)): A tensor containing the top_k most likely codes to the query. - confidence (torch.Tensor, shape (len(text), top_k)): A tensor array containing the corresponding confidence scores. - if explain is True: - attributions (torch.Tensor, shape (len(text), top_k, seq_len)): A tensor containing the attributions for each token in the text. From 4c22592df71319f12d866d6181c81aaa4a88fd02 Mon Sep 17 00:00:00 2001 From: EtiMag <55194599+EtiMag@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:58:09 +0100 Subject: [PATCH 2/2] fix return type in docstring If value_encoder is defined, return value from torchTextClassifiers.predict under key "prediction" is a numpy array instead of a Tensor, so .numpy() call fails. --- torchTextClassifiers/torchTextClassifiers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchTextClassifiers/torchTextClassifiers.py b/torchTextClassifiers/torchTextClassifiers.py index 226fe8e..8fef8bd 100644 --- a/torchTextClassifiers/torchTextClassifiers.py +++ b/torchTextClassifiers/torchTextClassifiers.py @@ -708,7 +708,7 @@ def predict( explain_with_captum (bool): launch gradient integration with Captum for explanation (default: False) Returns: A dictionary containing the following fields: - - prediction (torch.Tensor, shape (len(text), top_k)): A tensor containing the top_k most likely codes to the query. + - prediction (torch.Tensor | np.ndarray, shape (len(text), top_k)): A tensor containing the top_k most likely codes to the query. - confidence (torch.Tensor, shape (len(text), top_k)): A tensor array containing the corresponding confidence scores. - if explain is True: - attributions (torch.Tensor, shape (len(text), top_k, seq_len)): A tensor containing the attributions for each token in the text.