| 5403 | // ggml_ssm_conv |
| 5404 | |
| 5405 | struct ggml_tensor * ggml_ssm_conv( |
| 5406 | struct ggml_context * ctx, |
| 5407 | struct ggml_tensor * sx, |
| 5408 | struct ggml_tensor * c) { |
| 5409 | GGML_ASSERT(ggml_is_3d(sx)); |
| 5410 | GGML_ASSERT(ggml_is_matrix(c)); |
| 5411 | |
| 5412 | const int64_t d_conv = c->ne[0]; |
| 5413 | const int64_t d_inner = c->ne[1]; |
| 5414 | const int64_t n_t = sx->ne[0] - d_conv + 1; // tokens per sequence |
| 5415 | const int64_t n_s = sx->ne[2]; |
| 5416 | |
| 5417 | // TODO: maybe support other strides than 1? |
| 5418 | GGML_ASSERT(sx->ne[0] == d_conv - 1 + n_t); |
| 5419 | GGML_ASSERT(sx->ne[1] == d_inner); |
| 5420 | GGML_ASSERT(n_t >= 0); |
| 5421 | |
| 5422 | struct ggml_tensor * result = ggml_new_tensor_3d(ctx, GGML_TYPE_F32, d_inner, n_t, n_s); |
| 5423 | |
| 5424 | result->op = GGML_OP_SSM_CONV; |
| 5425 | result->src[0] = sx; |
| 5426 | result->src[1] = c; |
| 5427 | |
| 5428 | return result; |
| 5429 | } |
| 5430 | |
| 5431 | // ggml_ssm_scan |
| 5432 | |