File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -688,6 +688,9 @@ extern "C" {
688688 // true for tensor that is stored in memory as CxWxHxN and has been permuted to WxHxCxN
689689 GGML_API bool ggml_is_contiguous_channels (const struct ggml_tensor * tensor );
690690
691+ // true if the elements in dimension 0 are contiguous, or there is just 1 element
692+ GGML_API bool ggml_is_contiguous_rows (const struct ggml_tensor * tensor );
693+
691694 GGML_API bool ggml_are_same_shape (const struct ggml_tensor * t0 , const struct ggml_tensor * t1 );
692695 GGML_API bool ggml_are_same_stride (const struct ggml_tensor * t0 , const struct ggml_tensor * t1 );
693696
Original file line number Diff line number Diff line change @@ -1353,6 +1353,12 @@ bool ggml_is_contiguous_channels(const struct ggml_tensor * tensor) {
13531353 tensor -> nb [2 ] == ggml_type_size (tensor -> type );
13541354}
13551355
1356+ bool ggml_is_contiguous_rows (const struct ggml_tensor * tensor ) {
1357+ return
1358+ tensor -> ne [0 ] == 1 ||
1359+ tensor -> ne [0 ]* tensor -> nb [0 ] == tensor -> nb [1 ];
1360+ }
1361+
13561362static inline bool ggml_is_padded_1d (const struct ggml_tensor * tensor ) {
13571363 static_assert (GGML_MAX_DIMS == 4 , "GGML_MAX_DIMS is not 4 - update this function" );
13581364
You can’t perform that action at this time.
0 commit comments