MCPcopy Create free account
hub / github.com/Francis-Rings/StableAnimator / reshape_tensor

Function reshape_tensor

animation/modules/id_encoder.py:6–11  ·  view source on GitHub ↗
(x, heads)

Source from the content-addressed store, hash-verified

4from diffusers.models.modeling_utils import ModelMixin
5
6def reshape_tensor(x, heads):
7 bs, length, width = x.shape
8 x = x.view(bs, length, heads, -1)
9 x = x.transpose(1, 2)
10 x = x.reshape(bs, heads, length, -1)
11 return x
12
13class PerceiverAttention(nn.Module):
14 def __init__(self, *, dim, dim_head=64, heads=8):

Callers 1

forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected