| 762 | namespace { |
| 763 | |
| 764 | void gen_svd_input(HostTensorND& dest) { |
| 765 | auto ptr = dest.ptr<float>(); |
| 766 | auto dim = dest.layout().ndim; |
| 767 | size_t n = dest.layout().shape[dim - 2], m = dest.layout().shape[dim - 1]; |
| 768 | size_t j = 0, k = 0; |
| 769 | float batch_off = 0; |
| 770 | float max_val = std::min(m, n) * std::min(m, n) + 0.99; |
| 771 | for (size_t i = 0, it = dest.layout().total_nr_elems(); i < it; ++i) { |
| 772 | if (i % (n * m) == 0) { |
| 773 | batch_off += 0.32; |
| 774 | j = k = 0; |
| 775 | } |
| 776 | if (!((i % (n * m)) % (m + 1))) |
| 777 | ptr[i] = (j++) + ((++k / 10.0)); |
| 778 | else |
| 779 | ptr[i] = (j++); |
| 780 | ptr[i] += batch_off; |
| 781 | ptr[i] = std::fmod(ptr[i], max_val); |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | template <int have_u, int have_s, int have_v> |
| 786 | void run_svd_empty_grad_test() { |
nothing calls this directly
no test coverage detected