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

Method rows

engine/src/split/src/model.cpp:494–504  ·  view source on GitHub ↗

whole rows of a quantized 2-D tensor (or of matrix `mat` of a 3-D one)

Source from the content-addressed store, hash-verified

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");

Callers 7

decode_stepMethod · 0.45
fitMethod · 0.45
windowMethod · 0.45
load_layers_27bFunction · 0.45
load_cardFunction · 0.45
load_mtp_cardFunction · 0.45
MtpMethod · 0.45

Calls 4

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

Tested by

no test coverage detected