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

Function f32_to_bf16

engine/src/split/src/model.cpp:199–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199uint16_t f32_to_bf16(float x) {
200 uint32_t u;
201 std::memcpy(&u, &x, 4);
202 return (uint16_t) ((u + 0x7fffu + ((u >> 16) & 1u)) >> 16);
203}
204
205// an F32 tensor's first n values, read on the host
206const float* f32_data(const Tensor& t, size_t n) {

Callers 1

bf16Method · 0.70

Calls 1

memcpyFunction · 0.85

Tested by

no test coverage detected