File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -734,6 +734,12 @@ extern "C" {
734734 GGML_API const char * ggml_op_name (enum ggml_op op );
735735 GGML_API const char * ggml_op_symbol (enum ggml_op op );
736736
737+
738+ GGML_API const char * ggml_unary_op_name (enum ggml_unary_op op );
739+ GGML_API const char * ggml_op_desc (const struct ggml_tensor * t ); // unary or op name
740+
741+ GGML_API bool ggml_is_noop (const struct ggml_tensor * tensor );
742+
737743 GGML_API const char * ggml_unary_op_name (enum ggml_unary_op op );
738744 GGML_API const char * ggml_op_desc (const struct ggml_tensor * t ); // unary or op name
739745
Original file line number Diff line number Diff line change @@ -3773,6 +3773,12 @@ bool ggml_is_empty(const struct ggml_tensor * tensor) {
37733773 return false;
37743774}
37753775
3776+ bool ggml_is_noop(const struct ggml_tensor * tensor) {
3777+ return tensor->op == GGML_OP_NONE || tensor->op == GGML_OP_RESHAPE ||
3778+ tensor->op == GGML_OP_VIEW || tensor->op == GGML_OP_PERMUTE || tensor->op == GGML_OP_TRANSPOSE ||
3779+ ggml_is_empty(tensor) ? true : false;
3780+ }
3781+
37763782bool ggml_are_same_shape(const struct ggml_tensor * t0, const struct ggml_tensor * t1) {
37773783 static_assert(GGML_MAX_DIMS == 4, "GGML_MAX_DIMS is not 4 - update this function");
37783784
@@ -20035,6 +20041,8 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
2003520041 for (int node_n = 0; node_n < cgraph->n_nodes && !tp->abort; node_n++) {
2003620042 struct ggml_tensor * node = cgraph->nodes[node_n];
2003720043
20044+ if (ggml_is_noop(node)) continue;
20045+
2003820046 ggml_compute_forward(¶ms, node);
2003920047
2004020048 if (state->ith == 0 && cplan->abort_callback &&
You can’t perform that action at this time.
0 commit comments