ggml: fix ggml_is_contiguous_n for ne == 1 (#20092)
This commit is contained in:
+1
-3
@@ -1410,9 +1410,8 @@ static bool ggml_is_contiguous_n(const struct ggml_tensor * tensor, int n) {
|
|||||||
}
|
}
|
||||||
next_nb *= tensor->ne[0]/ggml_blck_size(tensor->type);
|
next_nb *= tensor->ne[0]/ggml_blck_size(tensor->type);
|
||||||
for (int i = 1; i < GGML_MAX_DIMS; i++) {
|
for (int i = 1; i < GGML_MAX_DIMS; i++) {
|
||||||
if (tensor->ne[i] != 1) {
|
|
||||||
if (i > n) {
|
if (i > n) {
|
||||||
if (tensor->nb[i] != next_nb) {
|
if (tensor->ne[i] != 1 && tensor->nb[i] != next_nb) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
next_nb *= tensor->ne[i];
|
next_nb *= tensor->ne[i];
|
||||||
@@ -1421,7 +1420,6 @@ static bool ggml_is_contiguous_n(const struct ggml_tensor * tensor, int n) {
|
|||||||
next_nb = tensor->ne[i]*tensor->nb[i];
|
next_nb = tensor->ne[i]*tensor->nb[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user