Skip to content

Commit

Permalink
facilitate the growth of TVM_CRT_MAX_NDIM
Browse files Browse the repository at this point in the history
Change-Id: I939fa43027a5c7529c5c7c6bd8d6e6beb91b7581
  • Loading branch information
liangfu committed Mar 26, 2020
1 parent 343831c commit b269a99
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions src/runtime/crt/graph_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,16 @@ int TVMGraphRuntimeGraphAttr_Load(TVMGraphRuntimeGraphAttr * attr, JSONReader *r
reader->ReadInteger(reader, attr_shape_ptr + 0);
uint32_t ndim = 1;
if (reader->NextArrayItem(reader)) {
if (reader->NextArrayItem(reader)) {
reader->ReadInteger(reader, attr_shape_ptr + 1); ndim++;
for (ndim = 1; ndim < TVM_CRT_MAX_NDIM; ndim++) {
if (reader->NextArrayItem(reader)) {
reader->ReadInteger(reader, attr_shape_ptr + 2); ndim++;
if (reader->NextArrayItem(reader)) {
reader->ReadInteger(reader, attr_shape_ptr + 3); ndim++;
if (reader->NextArrayItem(reader)) {
reader->ReadInteger(reader, attr_shape_ptr + 4); ndim++;
if (reader->NextArrayItem(reader)) {
reader->ReadInteger(reader, attr_shape_ptr + 5); ndim++;
reader->NextArrayItem(reader);
}
}
}
reader->ReadInteger(reader, attr_shape_ptr + ndim);
} else {
break;
}
}
if (ndim == TVM_CRT_MAX_NDIM) {
reader->NextArrayItem(reader);
}
}
attr->ndim[shape_count] = ndim;
shape_count++;
Expand Down Expand Up @@ -754,12 +748,12 @@ void TVMGraphRuntimeRelease(TVMGraphRuntime ** pptr) {
for (idx = 0; idx < runtime->data_entry_count; ++idx) {
vfree(runtime->data_entry[idx].dl_tensor.shape);
}
vfree((*pptr)->input_nodes);
vfree((*pptr)->node_row_ptr);
vfree((*pptr)->outputs);
vfree((*pptr)->storage_pool);
vfree((*pptr)->data_entry);
vfree((*pptr)->op_execs);
vfree(runtime->input_nodes);
vfree(runtime->node_row_ptr);
vfree(runtime->outputs);
vfree(runtime->storage_pool);
vfree(runtime->data_entry);
vfree(runtime->op_execs);
vfree(*pptr);

if (g_fexecs) {
Expand Down

0 comments on commit b269a99

Please sign in to comment.