| 12087 | // ggml_compute_forward_upscale |
| 12088 | |
| 12089 | static void ggml_compute_forward_upscale_f32( |
| 12090 | const struct ggml_compute_params * params, |
| 12091 | const struct ggml_tensor * src0, |
| 12092 | struct ggml_tensor * dst) { |
| 12093 | |
| 12094 | if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) { |
| 12095 | return; |
| 12096 | } |
| 12097 | |
| 12098 | GGML_ASSERT(src0->nb[0] == sizeof(float)); |
| 12099 | |
| 12100 | const int ith = params->ith; |
| 12101 | |
| 12102 | GGML_TENSOR_UNARY_OP_LOCALS |
| 12103 | |
| 12104 | const int scale_factor = dst->op_params[0]; |
| 12105 | |
| 12106 | // TODO: optimize |
| 12107 | |
| 12108 | for (int i03 = 0; i03 < ne03; i03++) { |
| 12109 | for (int i02 = ith; i02 < ne02; i02++) { |
| 12110 | for (int m = 0; m < dst->ne[1]; m++) { |
| 12111 | int i01 = m / scale_factor; |
| 12112 | for (int n = 0; n < dst->ne[0]; n++) { |
| 12113 | int i00 = n / scale_factor; |
| 12114 | |
| 12115 | const float * x = (float *)((char *) src0->data + i00 * nb00 +i01 * nb01 + i02 * nb02 + i03 * nb03); |
| 12116 | |
| 12117 | float * y = (float *)((char *) dst->data + n * dst->nb[0] + m * dst->nb[1] + i02 * dst->nb[2] + i03 * dst->nb[3]); |
| 12118 | |
| 12119 | *y = *x; |
| 12120 | } |
| 12121 | } |
| 12122 | } |
| 12123 | } |
| 12124 | } |
| 12125 | |
| 12126 | static void ggml_compute_forward_upscale( |
| 12127 | const struct ggml_compute_params * params, |
no outgoing calls
no test coverage detected