| 1693 | |
| 1694 | const ggml_tensor * src0 = dst->src[0]; |
| 1695 | |
| 1696 | switch (src0->type) { |
| 1697 | case GGML_TYPE_I32: |
| 1698 | { |
| 1699 | ggml_compute_forward_count_equal_i32(params, dst); |
| 1700 | } break; |
| 1701 | default: |
| 1702 | { |
| 1703 | GGML_ABORT("fatal error"); |
| 1704 | } |
| 1705 | } |
| 1706 | } |
| 1707 | |
| 1708 | // ggml_compute_forward_repeat |
| 1709 | |
| 1710 | static void ggml_compute_forward_repeat_f32( |
| 1711 | const ggml_compute_params * params, |
| 1712 | ggml_tensor * dst) { |
| 1713 | |
| 1714 | const ggml_tensor * src0 = dst->src[0]; |
| 1715 | |
| 1716 | if (params->ith != 0) { |
| 1717 | return; |
| 1718 | } |
| 1719 | |
| 1720 | GGML_ASSERT(ggml_can_repeat(src0, dst)); |
| 1721 | |
| 1722 | GGML_TENSOR_UNARY_OP_LOCALS |
| 1723 | |
| 1724 | // guaranteed to be an integer due to the check in ggml_can_repeat |
| 1725 | const int nr0 = (int)(ne0/ne00); |
| 1726 | const int nr1 = (int)(ne1/ne01); |
| 1727 | const int nr2 = (int)(ne2/ne02); |
| 1728 | const int nr3 = (int)(ne3/ne03); |
| 1729 | |
| 1730 | // TODO: support for transposed / permuted tensors |
| 1731 | GGML_ASSERT(nb0 == sizeof(float)); |
| 1732 | GGML_ASSERT(nb00 == sizeof(float)); |
| 1733 | |
| 1734 | // TODO: maybe this is not optimal? |
| 1735 | for (int i3 = 0; i3 < nr3; i3++) { |
| 1736 | for (int k3 = 0; k3 < ne03; k3++) { |
| 1737 | for (int i2 = 0; i2 < nr2; i2++) { |
| 1738 | for (int k2 = 0; k2 < ne02; k2++) { |
| 1739 | for (int i1 = 0; i1 < nr1; i1++) { |
| 1740 | for (int k1 = 0; k1 < ne01; k1++) { |
no test coverage detected