Ncnn: caffe prototxt的输入层问题

Created on 17 Dec 2018  ·  10Comments  ·  Source: Tencent/ncnn

我的prototxt有多个输入,并且batch_size不在第一维,而在第二维,类似下面的格式:

layer {
name: "input"
type: "Input"
top: "first_input"
top: "second_input"
input_param {
shape {
dim: 100
dim: 1
dim: 128
}
shape {
dim: 100
dim: 1
}
}
}
用caffe2ncnn转换正常,但是运行的时候显示param is too old, please regenerate,看起来是输入层还是有问题,所以我有几个问题:

  1. 像这样把所有的输入blob写在一层可以吗?还是需要用多个输入层来表示
  2. batch_size可以是第二维吗,还是一定要写在第一维?
  3. 能帮忙给出修改意见吗?

wish your help !~ QAQ

Most helpful comment

@nihui
我在你们的lstm的基础上修改了些bug,现在lstm可以跑出正确的结果了,能贡献给你们吗

All 10 comments

补充下,生成的param的magic number是7767517

@nihui

LSTM ?

LSTM ?

谢谢回复,是LSTM
现在param is too old的问题已经解决了,但是我好像发现了一个ncnn lstm实现的bug?在src/lstm.cpp里:

int LSTM::load_model(const ModelBin& mb)

{
    int size = weight_data_size / num_output / 4;

    // raw weight data
    weight_hc_data = mb.load(size, num_output * 4, 0);
    if (weight_hc_data.empty())
        return -100;

    weight_xc_data = mb.load(size, num_output * 4, 0);
    if (weight_xc_data.empty())
        return -100;

    bias_c_data = mb.load(4, num_output, 0);
    if (bias_c_data.empty())
        return -100;

    return 0;
}

这里面weight_hc_data 的大小应该是num_output * num_output *4吧?

因为知道 lstm.cpp 写的不对,所以才没有编译进去...

因为知道 lstm.cpp 写的不对,所以才没有编译进去...

哈哈哈。老哥你也太实诚了哈哈

@nihui
我在你们的lstm的基础上修改了些bug,现在lstm可以跑出正确的结果了,能贡献给你们吗

@z13974509906 非常欢迎!可以发pull request,感谢!

@nihui 搞定~

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nihui picture nihui  ·  5Comments

ghost picture ghost  ·  3Comments

sbsb99 picture sbsb99  ·  4Comments

yizhaoyanbo picture yizhaoyanbo  ·  3Comments

zsliaoming picture zsliaoming  ·  3Comments