MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / __init__

Method __init__

lightx2v/common/ops/attn/sparse_operator.py:247–250  ·  view source on GitHub ↗
(self, operator_setting={})

Source from the content-addressed store, hash-verified

245 # (B, H, Q_block_num, K_block_num) -> (H, Q_block_num, K_block_num)
246 mask = mask.squeeze(0)
247 q_ranges, k_ranges = self.generate_qk_ranges(mask, self.q_block_size, self.k_block_size, seqlen)
248 attn_type_map = torch.zeros(len(q_ranges), dtype=torch.int32, device="cpu").to(q.device, non_blocking=True)
249
250 statistics_qkv = (q, k, v)
251 q = q.permute(1, 0, 2).reshape(head_num * seqlen, 1, head_dim)
252 k = k.permute(1, 0, 2).reshape(head_num * seqlen, 1, head_dim)
253 v = v.permute(1, 0, 2).reshape(head_num * seqlen, 1, head_dim)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected