| 3513 | // ggml_reshape |
| 3514 | |
| 3515 | struct ggml_tensor * ggml_reshape( |
| 3516 | struct ggml_context * ctx, |
| 3517 | struct ggml_tensor * a, |
| 3518 | struct ggml_tensor * b) { |
| 3519 | GGML_ASSERT(ggml_is_contiguous(a)); |
| 3520 | // as only the shape of b is relevant, and not its memory layout, b is allowed to be non contiguous. |
| 3521 | GGML_ASSERT(ggml_nelements(a) == ggml_nelements(b)); |
| 3522 | |
| 3523 | struct ggml_tensor * result = ggml_new_tensor_impl(ctx, a->type, GGML_MAX_DIMS, b->ne, a, 0); |
| 3524 | ggml_format_name(result, "%s (reshaped)", a->name); |
| 3525 | |
| 3526 | result->op = GGML_OP_RESHAPE; |
| 3527 | result->src[0] = a; |
| 3528 | |
| 3529 | return result; |
| 3530 | } |
| 3531 | |
| 3532 | struct ggml_tensor * ggml_reshape_1d( |
| 3533 | struct ggml_context * ctx, |
no test coverage detected