copied from ggml.h - verify that we can access this as a flat array
| 132 | |
| 133 | // copied from ggml.h - verify that we can access this as a flat array |
| 134 | static bool tensor_is_contiguous(const struct ggml_tensor * tensor) { |
| 135 | static_assert(GGML_MAX_DIMS == 4, "GGML_MAX_DIMS is not 4 - update this function"); |
| 136 | |
| 137 | return |
| 138 | tensor->nb[0] == ggml_type_size(tensor->type) && |
| 139 | tensor->nb[1] == (tensor->nb[0]*tensor->ne[0])/ggml_blck_size(tensor->type) && |
| 140 | tensor->nb[2] == tensor->nb[1]*tensor->ne[1] && |
| 141 | tensor->nb[3] == tensor->nb[2]*tensor->ne[2]; |
| 142 | } |
| 143 | |
| 144 | static void test_roundtrip_on_chunk( |
| 145 | const ggml_tensor * layer, int64_t offset, int64_t chunk_size, const ggml_type_traits_t & qfns, bool use_reference, |