Skip to main content

ClikaRT::ops::ms_deform_attention

function

ms_deform_attention()

Tensor ms_deform_attention(
    Tensor value,
    Tensor spatial_shapes,
    Tensor level_start_index,
    Tensor sampling_locations,
    Tensor attention_weights
)

Multi-scale deformable attention (2-D): per query and head, gather P bilinear samples from each of L flattened feature-map levels and combine them with the given weights. value [N, S, M, D] with S = Σ_l H_l·W_l; spatial_shapes [L, 2] = per-level (H_l, W_l) and level_start_index [L] (both Int32 or Int64); sampling_locations [N, Lq, M, L, P, 2]; last dim (x, y), normalized to [0, 1] per level, sampled at loc·size − 0.5 (bilinear; out-of-bounds reads 0); attention_weights [N, Lq, M, L, P] are consumed AS GIVEN (apply softmax beforehand if wanted). Returns [N, Lq, M, D] at value's dtype; accumulation is fp32. The float inputs must share value's dtype (f32/f64/f16/bf16; no silent promotion).

Declared in ClikaRT/compute/ops.h, line 3809