| 5548 | // ggml_upscale |
| 5549 | |
| 5550 | static struct ggml_tensor * ggml_upscale_impl( |
| 5551 | struct ggml_context * ctx, |
| 5552 | struct ggml_tensor * a, |
| 5553 | int scale_factor) { |
| 5554 | bool is_node = false; |
| 5555 | |
| 5556 | if (a->grad) { |
| 5557 | GGML_ASSERT(false); // TODO: implement backward |
| 5558 | is_node = true; |
| 5559 | } |
| 5560 | |
| 5561 | struct ggml_tensor * result = ggml_new_tensor_4d(ctx, a->type, |
| 5562 | a->ne[0] * scale_factor, |
| 5563 | a->ne[1] * scale_factor, |
| 5564 | a->ne[2], a->ne[3]); |
| 5565 | |
| 5566 | result->op = GGML_OP_UPSCALE; |
| 5567 | result->op_params[0] = scale_factor; |
| 5568 | result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; |
| 5569 | result->src[0] = a; |
| 5570 | result->src[1] = NULL; |
| 5571 | |
| 5572 | return result; |
| 5573 | } |
| 5574 | |
| 5575 | struct ggml_tensor * ggml_upscale( |
| 5576 | struct ggml_context * ctx, |
no test coverage detected