MCPcopy Index your code
hub / github.com/pytorch/tutorials / PackedInputProjection

Class PackedInputProjection

intermediate_source/transformer_building_blocks.py:705–712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

703
704
705class PackedInputProjection(nn.Module):
706 def __init__(self, E_q, E_total, bias=False, device=None, dtype=None):
707 factory_kwargs = {"device": device, "dtype": dtype}
708 super().__init__()
709 self.packed_proj = nn.Linear(E_q, E_total * 3, bias=bias, **factory_kwargs)
710
711 def forward(self, query):
712 return torch.chunk(self.packed_proj(query), 3, dim=-1)
713
714
715B, D, dtype = 256, 8192, torch.bfloat16

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected