From bbbda337a954fc50377acbb145fc6d39e826d7e0 Mon Sep 17 00:00:00 2001 From: nomadoor Date: Fri, 17 Oct 2025 19:50:00 +0900 Subject: [PATCH] fix: replace view with reshape for tensor manipulation in _prune_duration function --- nodes/temporal_mask_remove_short_objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes/temporal_mask_remove_short_objects.py b/nodes/temporal_mask_remove_short_objects.py index db525be..320865d 100644 --- a/nodes/temporal_mask_remove_short_objects.py +++ b/nodes/temporal_mask_remove_short_objects.py @@ -73,7 +73,7 @@ def _prune_duration(mask_bool: Tensor, min_duration: int) -> Tensor: if min_duration <= 1: return mask_bool batch, frames, height, width = mask_bool.shape - flat = mask_bool.view(batch, frames, -1) + flat = mask_bool.reshape(batch, frames, -1) lengths = torch.zeros_like(flat, dtype=torch.int32) running = torch.zeros((batch, flat.shape[2]), dtype=torch.int32, device=mask_bool.device) for t in range(frames): @@ -86,7 +86,7 @@ def _prune_duration(mask_bool: Tensor, min_duration: int) -> Tensor: running = torch.where(active, running + 1, torch.zeros_like(running)) lengths[:, t, :] += running - 1 keep = lengths >= min_duration - return (flat & keep).view(batch, frames, height, width) + return (flat & keep).reshape(batch, frames, height, width) class TemporalMaskRemoveShortObjects(io.ComfyNode):