MCPcopy Create free account
hub / github.com/Niko1221/Strata / rows3

Method rows3

engine/src/split/src/model.cpp:522–537  ·  view source on GitHub ↗

rows r1 of t1, r2 of t2, then r3 of t3, one matrix

Source from the content-addressed store, hash-verified

520#if FNX_27B
521 // rows r1 of t1, r2 of t2, then r3 of t3, one matrix
522 DW rows3(const Tensor& t1, const std::vector<int>& r1, const Tensor& t2, const std::vector<int>& r2, const Tensor& t3,
523 const std::vector<int>& r3) {
524 for (const Tensor* t : {&t2, &t3})
525 if (t1.type != t->type || t1.ne[0] != t->ne[0]) throw std::runtime_error(t1.name + " and " + t->name + " do not stack");
526 DW w;
527 w.type = t1.type;
528 w.n_in = (int) t1.ne[0];
529 w.n_out = (int) (r1.size() + r2.size() + r3.size());
530 w.row_bytes = t1.row_bytes();
531 std::vector<uint8_t> h((size_t) w.n_out * w.row_bytes);
532 size_t o = 0;
533 for (const auto& [t, rs] : {std::pair{&t1, &r1}, std::pair{&t2, &r2}, std::pair{&t3, &r3}})
534 for (int r : *rs) { std::memcpy(&h[o], row_of(*t, r, w.row_bytes), w.row_bytes); o += w.row_bytes; }
535 w.p = put<uint8_t>(h.data(), h.size());
536 return w;
537 }
538#endif
539 // rows `rows` of t1 then of t2 as f32 (F32 rows as they are, Q8_0 rows dequantized)
540 float* f32_rows2(const Tensor& t1, const Tensor& t2, const std::vector<int>& rows, size_t row_floats) {

Callers 1

load_layers_27bFunction · 0.80

Calls 4

memcpyFunction · 0.85
sizeMethod · 0.45
row_bytesMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected