whole rows of a quantized 2-D tensor (or of matrix `mat` of a 3-D one)
| 492 | } |
| 493 | // whole rows of a quantized 2-D tensor (or of matrix `mat` of a 3-D one) |
| 494 | DW rows(const Tensor& t, const std::vector<int>& rows) { |
| 495 | DW w; |
| 496 | w.type = t.type; |
| 497 | w.n_in = (int) t.ne[0]; |
| 498 | w.n_out = (int) rows.size(); |
| 499 | w.row_bytes = t.row_bytes(); |
| 500 | std::vector<uint8_t> h(rows.size() * w.row_bytes); |
| 501 | for (size_t i = 0; i < rows.size(); ++i) std::memcpy(&h[i * w.row_bytes], row_of(t, rows[i], w.row_bytes), w.row_bytes); |
| 502 | w.p = put<uint8_t>(h.data(), h.size()); |
| 503 | return w; |
| 504 | } |
| 505 | // rows r1 of t1 then rows r2 of t2 (same type and row width), one matrix |
| 506 | DW rows2(const Tensor& t1, const std::vector<int>& r1, const Tensor& t2, const std::vector<int>& r2) { |
| 507 | if (t1.type != t2.type || t1.ne[0] != t2.ne[0]) throw std::runtime_error(t1.name + " and " + t2.name + " do not stack"); |
no test coverage detected