Closed wangchuanxd closed 9 years ago
Full connected layers can be implemented using vl_nnconv
net.layers{end+1} = struct('type', 'conv', ... 'filters', 0.01*randn(1,1,784,800,'single'),... 'biases', zeros(1,800,'single'), ... 'stride', 1, ... 'pad', 0) ;
For e.g the above code is to implement a fc layer with 784x800 weight matrix.
Note stride=1 and pad=0 and important.
conv function with these parameters works as a FC layer
Hi @wangchuanxd,
The function vl_nnconv.m is implemented in c++ and cuda. The relevant files to check are vl_nnconv.cpp and vl_nnconv.cu.
Vasilis
@drohit92 Oh, I see ! Thank you !
@bazilas OK ! I will check the related .cpp and .cu files ! Thank you !
@bazilas Hi, I am also new to MatConvNet. While working on my project, I found some issues with vl_nnconv.m file so I was wondering if you can help me clear them. To your comment above, I see that even the vl_nnconv.cpp file is empty. It just says to include the .cu version of the file. Now I am confused. So I guess it uses vl_nnconv.cu for both CPU and GPU compile options. In .cu file, I see the below lines which I think is specific for GPU compile. Is my understanding correct about this file?
#if ENABLE_GPU
#include "bits/datacu.hpp"
#endif
My other doubt is, Does this only support SINGLE/DOUBLE datatypes? I tried convolution of a SINGLE and an INT matrix, I got an error saying -
Error using vl_nnconv
An input is neither SINGLE or DOUBLE nor it is empty
Thanks, Ayushi
@vedaldi Hi. I am new to matconvnet. And I find the vl_nnconv.m in the file is empty, the reason I think so is there's no code in vl_nnconv.m, but all comments instead. Furthermore, if I want to define fully connected layer, does it mean that I have to write the code with matlab all by myself ? Maybe these questions are stupid. I hopefully you can help me. Thank you so much !