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

Function check_sdp_tensor

lightx2v_kernel_xpu/csrc/sdp.cpp:13–24  ·  view source on GitHub ↗

Validate tensor: must be XPU, contiguous, [B, L, H, 128], B=1

Source from the content-addressed store, hash-verified

11
12// Validate tensor: must be XPU, contiguous, [B, L, H, 128], B=1
13static void check_sdp_tensor(const torch::Tensor& t, const char* name) {
14 TORCH_CHECK(t.device().type() == c10::DeviceType::XPU,
15 name, " must be on XPU");
16 TORCH_CHECK(t.is_contiguous(),
17 name, " must be contiguous");
18 TORCH_CHECK(t.dim() == 4,
19 name, " must be 4-D [B, L, H, 128]");
20 TORCH_CHECK(t.size(0) == 1,
21 name, " batch size must be 1");
22 TORCH_CHECK(t.size(3) == 128,
23 name, " head_dim must be 128");
24}
25
26// ──────────────────────────────────────────────────────────────────────────────
27// sdp: unified Flash Attention SDP

Callers 1

sdp_torchFunction · 0.85

Calls 1

deviceMethod · 0.45

Tested by

no test coverage detected