|
|
|
@@ -1984,43 +1984,31 @@ int NetOptimize::save(const char* parampath, const char* binpath) |
|
|
|
} |
|
|
|
|
|
|
|
// write shape hints |
|
|
|
int shape_hint_array_size = 0; |
|
|
|
bool shape_ready = true; |
|
|
|
for (int j=0; j<top_count; j++) |
|
|
|
{ |
|
|
|
int top_blob_index = layer->tops[j]; |
|
|
|
|
|
|
|
int dims = blobs[top_blob_index].shape.dims; |
|
|
|
if (dims == 0) |
|
|
|
{ |
|
|
|
shape_hint_array_size = 0; |
|
|
|
shape_ready = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
shape_hint_array_size += dims + 1; |
|
|
|
} |
|
|
|
if (shape_hint_array_size) |
|
|
|
if (shape_ready) |
|
|
|
{ |
|
|
|
fprintf(pp, " -23330=%d", shape_hint_array_size); |
|
|
|
fprintf(pp, " -23330=%d", top_count*4); |
|
|
|
for (int j=0; j<top_count; j++) |
|
|
|
{ |
|
|
|
int top_blob_index = layer->tops[j]; |
|
|
|
|
|
|
|
int dims = blobs[top_blob_index].shape.dims; |
|
|
|
int w = blobs[top_blob_index].shape.w; |
|
|
|
int h = blobs[top_blob_index].shape.h; |
|
|
|
int c = blobs[top_blob_index].shape.c; |
|
|
|
fprintf(pp, ",%d", dims); |
|
|
|
|
|
|
|
if (dims == 1) |
|
|
|
{ |
|
|
|
fprintf(pp, ",%d", w); |
|
|
|
} |
|
|
|
if (dims == 2) |
|
|
|
{ |
|
|
|
fprintf(pp, ",%d,%d", w, h); |
|
|
|
} |
|
|
|
if (dims == 3) |
|
|
|
{ |
|
|
|
fprintf(pp, ",%d,%d,%d", w, h, c); |
|
|
|
} |
|
|
|
fprintf(pp, ",%d,%d,%d,%d", dims, w, h, c); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|