| 3777 | // ggml_get_rows |
| 3778 | |
| 3779 | struct ggml_tensor * ggml_get_rows( |
| 3780 | struct ggml_context * ctx, |
| 3781 | struct ggml_tensor * a, |
| 3782 | struct ggml_tensor * b) { |
| 3783 | GGML_ASSERT(a->ne[2] == b->ne[1]); |
| 3784 | GGML_ASSERT(a->ne[3] == b->ne[2]); |
| 3785 | GGML_ASSERT(b->ne[3] == 1); |
| 3786 | GGML_ASSERT(b->type == GGML_TYPE_I32); |
| 3787 | |
| 3788 | // TODO: implement non F32 return |
| 3789 | enum ggml_type type = GGML_TYPE_F32; |
| 3790 | if (a->type == GGML_TYPE_I32) { |
| 3791 | type = a->type; |
| 3792 | } |
| 3793 | struct ggml_tensor * result = ggml_new_tensor_4d(ctx, type, a->ne[0], b->ne[0], b->ne[1], b->ne[2]); |
| 3794 | |
| 3795 | result->op = GGML_OP_GET_ROWS; |
| 3796 | result->src[0] = a; |
| 3797 | result->src[1] = b; |
| 3798 | |
| 3799 | return result; |
| 3800 | } |
| 3801 | |
| 3802 | // ggml_get_rows_back |
| 3803 | |