Skip to content

Commit

Permalink
Refactor: Remove redunt args[]
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaarezvan committed Jul 6, 2023
1 parent 8200975 commit b7fd1a4
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -16658,20 +16658,14 @@ void ggml_graph_export(const struct ggml_cgraph * cgraph, const char * fname) {

// output the op arguments
{
struct ggml_tensor * args[GGML_MAX_OPT] = { NULL };

for (int j = 0; j < GGML_MAX_OPT; ++j) {
args[j] = tensor->src[j];
}

for (int j = 0; j < GGML_MAX_OPT; ++j) {
if (args[j]) {
if (tensor->src[j]) {
int32_t idx = -1;

// check if leaf
{
for (int k = 0; k < cgraph->n_leafs; ++k) {
if (args[j] == cgraph->leafs[k]) {
if (tensor->src[j] == cgraph->leafs[k]) {
idx = k;
break;
}
Expand All @@ -16681,7 +16675,7 @@ void ggml_graph_export(const struct ggml_cgraph * cgraph, const char * fname) {
// check if node
if (idx == -1) {
for (int k = 0; k < cgraph->n_nodes; ++k) {
if (args[j] == cgraph->nodes[k]) {
if (tensor->src[j] == cgraph->nodes[k]) {
idx = GGML_MAX_NODES + k;
break;
}
Expand Down

0 comments on commit b7fd1a4

Please sign in to comment.