| 93 | } |
| 94 | |
| 95 | static inline int32_t get_tensor_value(const Tensor* tensor, int index) { |
| 96 | if (tensor->dtype.type_enum == TinyNN_FLOAT) { |
| 97 | return *((float*)(tensor->ptr) + index); |
| 98 | } else if (tensor->dtype.type_enum == TinyNN_INT) { |
| 99 | return *((int32_t*)(tensor->ptr) + index); |
| 100 | } else if (tensor->dtype.type_enum == TinyNN_INT8) { |
| 101 | return *((int8_t*)(tensor->ptr) + index); |
| 102 | } else { |
| 103 | TINYNN_ASSERT_MSG(0, "unsupport dtype.\n"); |
| 104 | } |
| 105 | return 0; |
| 106 | } |
| 107 | #endif |