ggml : add ggml_op_is_empty (#16122)

* ggml : add ggml_op_is_empty

* ggml : move to ggml-impl.h
This commit is contained in:
Georgi Gerganov
2025-09-22 11:12:09 +03:00
committed by GitHub
parent 05a2458121
commit a71ae3ba7a
2 changed files with 16 additions and 17 deletions

View File

@@ -73,7 +73,7 @@ static inline int ggml_up(int n, int m) {
return (n + m - 1) & ~(m - 1);
}
// TODO: move to ggml.h?
// TODO: move to ggml.h? (won't be able to inline)
static bool ggml_are_same_layout(const struct ggml_tensor * a, const struct ggml_tensor * b) {
if (a->type != b->type) {
return false;
@@ -89,6 +89,19 @@ static bool ggml_are_same_layout(const struct ggml_tensor * a, const struct ggml
return true;
}
static bool ggml_op_is_empty(enum ggml_op op) {
switch (op) {
case GGML_OP_NONE:
case GGML_OP_RESHAPE:
case GGML_OP_TRANSPOSE:
case GGML_OP_VIEW:
case GGML_OP_PERMUTE:
return true;
default:
return false;
}
}
//
// logging
//