MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ggml_upscale_impl

Function ggml_upscale_impl

ggml.c:5550–5573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5548// ggml_upscale
5549
5550static 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
5575struct ggml_tensor * ggml_upscale(
5576 struct ggml_context * ctx,

Callers 1

ggml_upscaleFunction · 0.70

Calls 2

ggml_new_tensor_4dFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected