| 13 | #include <cstring> |
| 14 | |
| 15 | void llm_graph_input_embd::set_input(const llama_ubatch * ubatch) { |
| 16 | if (ubatch->token) { |
| 17 | const int64_t n_tokens = ubatch->n_tokens; |
| 18 | |
| 19 | ggml_backend_tensor_set(tokens, ubatch->token, 0, n_tokens*ggml_element_size(tokens)); |
| 20 | } |
| 21 | |
| 22 | if (ubatch->embd) { |
| 23 | const int64_t n_embd = embd->ne[0]; |
| 24 | const int64_t n_tokens = ubatch->n_tokens; |
| 25 | |
| 26 | ggml_backend_tensor_set(embd, ubatch->embd, 0, n_tokens*n_embd*ggml_element_size(embd)); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | void llm_graph_input_pos::set_input(const llama_ubatch * ubatch) { |
| 31 | if (ubatch->pos && pos) { |
no test coverage detected