torch:module
(torch:module kind fields forward-fn)
Returns a new module -- the parameter-owning, composable object of the torch package. kind is a keyword naming the layer, fields a plist of keyword/value pairs holding every parameter, buffer, submodule and hyper-parameter, and forward-fn is what torch:forward applies, as (funcall forward-fn module args...).
The fields plist is the module's parameter registration: torch:parameters walks it, so a layer's forward must read its parameters back with torch:field rather than from a closed-over variable. A field holding a tensor without requires-grad is a buffer and is skipped by the walk. The built-in layers (torch:linear and friends) are ordinary callers of this function.