| 18 | #include <cmath> |
| 19 | |
| 20 | void ggml_tensor_set_f32(struct ggml_tensor* tensor, float value, int l, int k = 0, int j = 0, int i = 0) { |
| 21 | GGML_ASSERT(tensor->nb[0] == sizeof(float)); |
| 22 | *(float*)((char*)(tensor->data) + i * tensor->nb[3] + j * tensor->nb[2] + k * tensor->nb[1] + l * tensor->nb[0]) = value; |
| 23 | } |
| 24 | |
| 25 | void set_timestep_embedding(struct ggml_tensor* timesteps, struct ggml_tensor* embedding, int dim, int max_period = 10000) { |
| 26 | // timesteps: [N,] |
no outgoing calls
no test coverage detected