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" {
688
688
// true for tensor that is stored in memory as CxWxHxN and has been permuted to WxHxCxN
689
689
GGML_API bool ggml_is_contiguous_channels (const struct ggml_tensor * tensor );
690
690
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
+
691
694
GGML_API bool ggml_are_same_shape (const struct ggml_tensor * t0 , const struct ggml_tensor * t1 );
692
695
GGML_API bool ggml_are_same_stride (const struct ggml_tensor * t0 , const struct ggml_tensor * t1 );
693
696
Original file line number Diff line number Diff line change @@ -1353,6 +1353,12 @@ bool ggml_is_contiguous_channels(const struct ggml_tensor * tensor) {
1353
1353
tensor -> nb [2 ] == ggml_type_size (tensor -> type );
1354
1354
}
1355
1355
1356
+ bool ggml_is_contiguous_rows (const struct ggml_tensor * tensor ) {
1357
+ return
1358
+ tensor -> ne [0 ] == 1 ||
1359
+ tensor -> nb [0 ] == ggml_type_size (tensor -> type )* ggml_blck_size (tensor -> type );
1360
+ }
1361
+
1356
1362
static inline bool ggml_is_padded_1d (const struct ggml_tensor * tensor ) {
1357
1363
static_assert (GGML_MAX_DIMS == 4 , "GGML_MAX_DIMS is not 4 - update this function" );
1358
1364
You can’t perform that action at this time.
0 commit comments