MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / build_mask

Method build_mask

diffsynth/models/stepvideo_vae.py:1040–1050  ·  view source on GitHub ↗
(self, data, is_bound, border_width)

Source from the content-addressed store, hash-verified

1038 return x
1039
1040 def build_mask(self, data, is_bound, border_width):
1041 _, _, _, H, W = data.shape
1042 h = self.build_1d_mask(H, is_bound[0], is_bound[1], border_width[0])
1043 w = self.build_1d_mask(W, is_bound[2], is_bound[3], border_width[1])
1044
1045 h = repeat(h, "H -> H W", H=H, W=W)
1046 w = repeat(w, "W -> H W", H=H, W=W)
1047
1048 mask = torch.stack([h, w]).min(dim=0).values
1049 mask = rearrange(mask, "H W -> 1 1 1 H W")
1050 return mask
1051
1052 def tiled_decode(self, hidden_states, device, tile_size=(34, 34), tile_stride=(16, 16)):
1053 B, T, C, H, W = hidden_states.shape

Callers 1

tiled_decodeMethod · 0.95

Calls 1

build_1d_maskMethod · 0.95

Tested by

no test coverage detected