koraykv/torch-nngraph — pull request #7 by fidlej (2013-07-17 13:07:13+00:00)
Title: Allowed to pass a function to runForwardFunction()

Would it be OK to allow to pass a function to runForwardFunction()?
Passing of a function is more flexible.
The modules don't need to have the function.
For example, I can call 'generate', if it is present on a module:

local generateWithFallback = function(module, input)
return (module.generate or module.updateOutput)(module, input)
end
net:runForwardFunction(generateWithFallback, input)