f32 tensors' rows one after another
| 626 | } |
| 627 | // f32 tensors' rows one after another |
| 628 | float* f32_cat(const Tensor& t1, const Tensor& t2, size_t row_floats) { |
| 629 | if (t1.type != T_F32 || t2.type != T_F32 || t1.ne[0] != t2.ne[0]) throw std::runtime_error(t1.name + " and " + t2.name + " do not stack"); |
| 630 | if ((size_t) t1.ne[0] != row_floats) |
| 631 | throw std::runtime_error(t1.name + " is " + std::to_string(t1.ne[0]) + " floats a row, not the " + std::to_string(row_floats) + |
| 632 | " its reader takes"); |
| 633 | std::vector<float> h((const float*) t1.data, (const float*) t1.data + t1.ne[0] * t1.ne[1]); |
| 634 | h.insert(h.end(), (const float*) t2.data, (const float*) t2.data + t2.ne[0] * t2.ne[1]); |
| 635 | return put<float>(h.data(), h.size() * 4); |
| 636 | } |
| 637 | // per expert: every row, input blocks [b0, b1) (down), expert-major |
| 638 | DW expert_cols(const Tensor& t, int b0, int b1, size_t& stride, const char** host_of = nullptr) { |
| 639 | const TypeInfo ti = block32(t); |