| 1144 | } |
| 1145 | |
| 1146 | int 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 | |
| 1158 | int 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"); |
nothing calls this directly
no test coverage detected