ops: seg_softmax_pool, each segment's rows summed under the softmax of their scores

This commit is contained in:
Brandon Bertelsen committed 2026-10-28 00:33:55 -04:00
1 parent 5a2732f063
commit 555fbf62f5
14 files changed
+224

No files matched your search

+13
View File
@@ -546,6 +546,19 @@ int ref_seg_mean_shape(const RadParam* p, int n_p, int operand, RadOpdDesc* out)
return o.finish("seg_mean", operand, out);
}
int ref_seg_softmax_pool_shape(const RadParam* p, int n_p, int operand, RadOpdDesc* out) {
const uint32_t D = act_dt(p, n_p);
const int64_t M = gi(p, n_p, "M", 0), n = gi(p, n_p, "n", 0);
if (M <= 0 || n <= 0) return RAD_E_UNSUPPORTED;
const int64_t S = n_seq_of(p, n_p);
Opd o;
o.t(D, { M }); /* score, one a row of v */
o.t(D, { M, n }); /* v */
o.t_idx({ S + 1 }, 0, -1, (uint32_t)RAD_OPD_F_IDX_CU); /* cu_seqlens */
o.t(D, { S, n }); /* y */
return o.finish("seg_softmax_pool", operand, out);
}
int ref_pool_rows_shape(const RadParam* p, int n_p, int operand, RadOpdDesc* out) {
const uint32_t D = act_dt(p, n_p);
const int64_t n = gi(p, n_p, "n", 0), k = gi(p, n_p, "k", 0);