我的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,看起来是输入层还是有问题,所以我有几个问题:
wish your help !~ QAQ
补充下,生成的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 搞定~
pull request merged
https://github.com/Tencent/ncnn/commit/225d4925c07c5bd32ff1b37c77e6049aaa0735f0
thanks a lot !
Most helpful comment
@nihui
我在你们的lstm的基础上修改了些bug,现在lstm可以跑出正确的结果了,能贡献给你们吗