MCPcopy Create free account
hub / github.com/ChunmingHe/WS-SAM / unstack_and_split

Function unstack_and_split

lib/Slot.py:61–65  ·  view source on GitHub ↗

Unstack batch dimension and split into channels and alpha mask.

(x, batch_size, num_channels=3)

Source from the content-addressed store, hash-verified

59
60
61def unstack_and_split(x, batch_size, num_channels=3):
62 """Unstack batch dimension and split into channels and alpha mask."""
63 unstacked = einops.rearrange(x, '(b s) c h w -> b s c h w', b=batch_size)
64 channels, masks = torch.split(unstacked, [num_channels, 1], dim=2)
65 return channels, masks
66
67
68class SlotAttention(nn.Module):

Callers 2

forwardMethod · 0.90
forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected