ncnn
1. -23300的意思
在ncnn的模型结构参数中,有-23300
的参数,如:
code
Slice Split_394 1 2 886 887 888 -23330=8,3,40,40,80,3,40,40,32 -23300=2,80,-233
这表示=
后面的参数是一个数组参数,2,80,-233
表示有2个变量,80,-233。
解析时候的代码:
bool is_array = id <= -23300;
if (is_array)
{
id = -id - 23300;
}
if (id >= NCNN_MAX_PARAM_COUNT)
{
NCNN_LOGE("id < NCNN_MAX_PARAM_COUNT failed (id=%d, NCNN_MAX_PARAM_COUNT=%d)", id, NCNN_MAX_PARAM_COUNT);
return -1;
}
if (is_array)
{
int len = 0;
int nscan = dr.scan("%d", &len);
if (nscan != 1)
{
NCNN_LOGE("ParamDict read array length failed");
return -1;
}
- 解析的时候会通过
id = -id - 23300
,将id置为0。
2. -233的意思
这里-233
数值的具体意义需要看具体layer中的定义了。比如slice layer
中:
int q = 0;
for(size_t i = 0; i < top_blobs.size(); i++)
{
int slice = slices_ptr[i];
if (slice == -233)
{
slice = static_cast<int>((channels - q) / (top_blobs.size() - i));
}
Mat& top_blob = top_blobs[i];
top_blob.create(w, h, slice, elemsize, opt.blob_allocator);
if (top_blob.empty())
return -100;
int size = static_cast<int>(bottom_blob.cstep * slice);
const unsigned char* ptr = bottom_blob.channel(q);
unsigned char* outptr = top_blob;
memcpy(outptr, ptr, size * elemsize);
q += slice;
}
这里等价于平均split。