| 2016 | } |
| 2017 | |
| 2018 | struct ggml_tensor * ggml_add_id( |
| 2019 | struct ggml_context * ctx, |
| 2020 | struct ggml_tensor * a, |
| 2021 | struct ggml_tensor * b, |
| 2022 | struct ggml_tensor * ids) { |
| 2023 | |
| 2024 | GGML_ASSERT(a->ne[0] == b->ne[0]); |
| 2025 | GGML_ASSERT(a->ne[1] == ids->ne[0]); |
| 2026 | GGML_ASSERT(a->ne[2] == ids->ne[1]); |
| 2027 | GGML_ASSERT(ids->type == GGML_TYPE_I32); |
| 2028 | |
| 2029 | struct ggml_tensor * result = ggml_dup_tensor(ctx, a); |
| 2030 | |
| 2031 | result->op = GGML_OP_ADD_ID; |
| 2032 | result->src[0] = a; |
| 2033 | result->src[1] = b; |
| 2034 | result->src[2] = ids; |
| 2035 | |
| 2036 | return result; |
| 2037 | } |
| 2038 | |
| 2039 | // ggml_add1 |
| 2040 | |