examples: refine tensor dump

This commit is contained in:
zhou.weiguo 2024-06-10 12:37:27 +08:00
parent 2c96a5cd8b
commit 3695a2b00f
No known key found for this signature in database
GPG key ID: 952EA81D18BB2FA8

View file

@ -39,9 +39,15 @@ typedef struct {
} block_q8_0; } block_q8_0;
static inline float ggml_compute_fp16_to_fp32(uint16_t h) { static inline float ggml_compute_fp16_to_fp32(uint16_t h) {
#if defined(__ARM_NEON)
__fp16 tmp;
memcpy(&tmp, &h, sizeof(uint16_t));
return (float) tmp;
#else
uint16_t tmp; uint16_t tmp;
memcpy(&tmp, &h, sizeof(uint16_t)); memcpy(&tmp, &h, sizeof(uint16_t));
return (float) tmp; return (float) tmp;
#endif
} }
static float tensor_sum_elements(const ggml_tensor * tensor) { static float tensor_sum_elements(const ggml_tensor * tensor) {