MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / buildOutputEmbedding

Function buildOutputEmbedding

plugins/wasi_nn/wasinn_bitnet.cpp:1584–1601  ·  view source on GitHub ↗

Generate output embedding.

Source from the content-addressed store, hash-verified

1582
1583// Generate output embedding.
1584void buildOutputEmbedding(std::string &Embedding, int32_t NEmbd,
1585 const float *Embeddings) noexcept {
1586 // Embedding vector format
1587 // | Content |
1588 // | ----------------------------------- |
1589 // | '{"number_embedding": ' |
1590 // | n_embedding |
1591 // | ', "embedding": ' |
1592 // | '[' |
1593 // | n_embedding*(embedding value %.10f) |
1594 // | (n_embedding-1)*(',') |
1595 // | ']' |
1596 // | '}' |
1597 Embedding =
1598 fmt::format(R"({{"n_embedding": {}, )"
1599 R"("embedding": [{:.10}]}})"sv,
1600 NEmbd, fmt::join(Embeddings, Embeddings + NEmbd, ","sv));
1601}
1602// <<<<<<<< Output related functions <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
1603
1604// >>>>>>>> Compute related functions >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Callers 1

getEmbeddingFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected