| 3547 | } |
| 3548 | |
| 3549 | struct ggml_tensor * ggml_reshape_2d( |
| 3550 | struct ggml_context * ctx, |
| 3551 | struct ggml_tensor * a, |
| 3552 | int64_t ne0, |
| 3553 | int64_t ne1) { |
| 3554 | GGML_ASSERT(ggml_is_contiguous(a)); |
| 3555 | GGML_ASSERT(ggml_nelements(a) == ne0*ne1); |
| 3556 | |
| 3557 | const int64_t ne[2] = { ne0, ne1 }; |
| 3558 | struct ggml_tensor * result = ggml_new_tensor_impl(ctx, a->type, 2, ne, a, 0); |
| 3559 | ggml_format_name(result, "%s (reshaped)", a->name); |
| 3560 | |
| 3561 | result->op = GGML_OP_RESHAPE; |
| 3562 | result->src[0] = a; |
| 3563 | |
| 3564 | return result; |
| 3565 | } |
| 3566 | |
| 3567 | struct ggml_tensor * ggml_reshape_3d( |
| 3568 | struct ggml_context * ctx, |