add explicit cast to fix compile error

"error: non-constant-expression cannot be narrowed from type 'int64_t' (aka 'long long') to 'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]"
This commit is contained in:
xaedes 2023-05-31 15:00:54 +02:00
parent f88fb2bdc5
commit 01fc3faf71
No known key found for this signature in database
GPG key ID: 30030EDD817EA2B1

View file

@ -1788,7 +1788,10 @@ void write_tensor(struct llama_file * file, struct ggml_tensor * tensor) {
const char * name = ggml_get_name(tensor); const char * name = ggml_get_name(tensor);
uint32_t name_len = strlen(name); uint32_t name_len = strlen(name);
uint32_t nd = tensor->n_dims; uint32_t nd = tensor->n_dims;
uint32_t ne[4] = { tensor->ne[0], tensor->ne[1], tensor->ne[2], tensor->ne[3] }; uint32_t ne[4] = { (uint32_t)tensor->ne[0],
(uint32_t)tensor->ne[1],
(uint32_t)tensor->ne[2],
(uint32_t)tensor->ne[3] };
file->write_u32(nd); file->write_u32(nd);
file->write_u32(name_len); file->write_u32(name_len);
file->write_u32(tensor->type); file->write_u32(tensor->type);