From 5f8fba1ba3d9126984ccae797ac86a6ef486f2f0 Mon Sep 17 00:00:00 2001 From: Hongbo <12580159+ya0guang@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:58:14 -0500 Subject: [PATCH] Fix the bug in `utils_motion.py` This statement is syntactically correct, but its behavior might not match the expected outcome due to the way Python's conditional (ternary) operator precedence works. In Python, the conditional expression has lower precedence than the comma. --- animatediff/utils_motion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/animatediff/utils_motion.py b/animatediff/utils_motion.py index 35f8129..e3e634b 100644 --- a/animatediff/utils_motion.py +++ b/animatediff/utils_motion.py @@ -149,7 +149,7 @@ def get_combined_multival(multivalA: Union[float, Tensor], multivalB: Union[floa areaA = multivalA.shape[1]*multivalA.shape[2] areaB = multivalB.shape[1]*multivalB.shape[2] # match height/width to mask with larger area - leader,follower = multivalA,multivalB if areaA >= areaB else multivalB,multivalA + leader,follower = (multivalA,multivalB) if areaA >= areaB else (multivalB,multivalA) batch_size = multivalA.shape[0] if multivalA.shape[0] >= multivalB.shape[0] else multivalB.shape[0] # make follower same dimensions as leader follower = torch.unsqueeze(follower, 1)