jzbontar / mc-cnn

Stereo Matching by Training a Convolutional Neural Network to Compare Image Patches
BSD 2-Clause "Simplified" License
707 stars 232 forks source link

question about forward_free() function #13

Closed Sarah20187 closed 6 years ago

Sarah20187 commented 7 years ago

As torch has its own forward function, why use forward_free in net_te1?

jzbontar commented 7 years ago

forward_free is a memory optimized version of torch's default forward method. The idea is simple: if you don't need to compute gradients, you don't need to store the outputs of each layer.

Today, I would simply use https://github.com/fmassa/optimize-net, but this module did not exist when the mc-cnn code was written.

Sarah20187 commented 7 years ago

@jzbontar I found that in evaluation mode, forward_free() perform much better than optnet(set parameters to {mode='inference', inplace=false} )