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

Method f32_rows

engine/src/split/src/model.cpp:404–413  ·  view source on GitHub ↗

rows `rows` of a 2-D F32 tensor (ne1 indexes rows)

Source from the content-addressed store, hash-verified

402 }
403 // rows `rows` of a 2-D F32 tensor (ne1 indexes rows)
404 float* f32_rows(const Tensor& t, const std::vector<int>& rows, size_t row_floats) {
405 if (t.type != T_F32) throw std::runtime_error(t.name + " is not F32");
406 if ((size_t) t.ne[0] != row_floats)
407 throw std::runtime_error(t.name + " is " + std::to_string(t.ne[0]) + " floats a row, not the " + std::to_string(row_floats) +
408 " its reader takes");
409 std::vector<float> h(rows.size() * (size_t) t.ne[0]);
410 for (size_t i = 0; i < rows.size(); ++i)
411 std::memcpy(&h[i * t.ne[0]], row_of(t, rows[i], (size_t) t.ne[0] * 4), (size_t) t.ne[0] * 4);
412 return put<float>(h.data(), h.size() * 4);
413 }
414 // Q8_0 -> bf16, the whole tensor; F32 -> bf16 likewise
415 uint16_t* bf16(const Tensor& t) {
416 const size_t n = (size_t) (t.ne[0] * t.ne[1] * t.ne[2] * t.ne[3]);

Callers 2

load_layers_27bFunction · 0.80
load_cardFunction · 0.80

Calls 4

memcpyFunction · 0.85
to_stringFunction · 0.50
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected