MCPcopy Create free account
hub / github.com/cactus-compute/cactus / cactus_graph_sample

Function cactus_graph_sample

cactus/ffi/cactus_graph.cpp:1146–1156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1144}
1145
1146int cactus_graph_sample(cactus_graph_t graph, cactus_node_t logits, float temperature, float top_p, size_t top_k, cactus_node_t* out) {
1147 if (!graph || !out) return fail_invalid("Invalid args to cactus_graph_sample");
1148 try {
1149 std::unordered_map<uint32_t, float> empty_bias;
1150 *out = static_cast<cactus_node_t>(as_graph(graph)->graph.sample(static_cast<size_t>(logits), temperature, top_p, top_k, empty_bias));
1151 return 0;
1152 } catch (const std::exception& e) {
1153 last_error_message = e.what();
1154 return -1;
1155 }
1156}
1157
1158int cactus_graph_scatter_topk(cactus_graph_t graph, cactus_node_t indices, cactus_node_t values, size_t num_classes, cactus_node_t* out) {
1159 if (!graph || !out) return fail_invalid("Invalid args to cactus_graph_scatter_topk");

Callers

nothing calls this directly

Calls 3

fail_invalidFunction · 0.85
as_graphFunction · 0.85
sampleMethod · 0.80

Tested by

no test coverage detected