Commit ca4f95ed authored by Davis King's avatar Davis King

Made the fc layer output 1x1 images with many feature maps.

parent 50143615
......@@ -77,15 +77,13 @@ namespace dlib
num_inputs = sub.get_output().nr()*sub.get_output().nc()*sub.get_output().k();
params.set_size(num_inputs, num_outputs);
std::cout << "fc_::setup() " << params.size() << std::endl;
randomize_parameters(params, num_inputs+num_outputs, rnd);
}
template <typename SUBNET>
void forward(const SUBNET& sub, resizable_tensor& output)
{
output.set_size(sub.get_output().num_samples(), num_outputs);
output.set_size(sub.get_output().num_samples(), 1,1,num_outputs);
output = mat(sub.get_output())*mat(params);
}
......@@ -93,10 +91,6 @@ namespace dlib
template <typename SUBNET>
void backward(const tensor& gradient_input, SUBNET& sub, tensor& params_grad)
{
// d1*W*p1 + d2*W*p2
// total gradient = [d1*W; d2*W; d3*W; ...] == D*W
// compute the gradient of the parameters.
params_grad += trans(mat(sub.get_output()))*mat(gradient_input);
......
......@@ -252,7 +252,7 @@ namespace dlib
- This layer outputs column vectors that contain get_num_outputs()
elements. That is, the output tensor T from forward() will be such that:
- T.num_samples() == however many samples were given to forward().
- T.nr() == get_num_outputs()
- T.k() == get_num_outputs()
- The rest of the dimensions of T will be 1.
!*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment