diff --git a/dan/predict/attention.py b/dan/predict/attention.py index a2657f5d5c1261aff49a1d1dd4f42ceac74eeac1..3d32b5c8f899189d5b4b89fb1cd057e08dd49f7b 100644 --- a/dan/predict/attention.py +++ b/dan/predict/attention.py @@ -44,8 +44,7 @@ def compute_coverage(text: str, max_value: float, offset: int, attentions): # blank vector to accumulate weights for the current text coverage_vector = np.zeros((height, width)) for i in range(len(text)): - local_weight = attentions[i + offset] - local_weight = cv2.resize(local_weight, (width, height)) + local_weight = cv2.resize(attentions[i + offset], (width, height)) coverage_vector = np.clip(coverage_vector + local_weight, 0, 1) # Normalize coverage vector