Rest
...modules: Module[]Private
immediateAdds a child module of the current module.
The module can be accessed as a property using the given name.
name of the child module
child module to be added
Loads the state of the module and its descendants from the given state dictionary.
The state dictionary containing the state of the module to load.
Returns this module and its descendants' along with their prefixed names.
Optional
memo: Set<Module>is a set of modules used to avoid double counting.
is prependended to the names of the modules.
is a boolean indicating whether to remove duplicate modules.
a generator of [prefixed name, module] pairs.
Gets this module and its descendants' (if recurse = true
) parameters along with their prefixed names.
is prependended to the names of the parameters
whether to include submodule parameters
whether to remove duplicate parameters
a generator of [prefixed name, parameter] pairs
Returns the state dictionary of the module and its descendants.
Optional
destination: StateDictAn optional state dictionary to update with the module's state.
A string to prepend to the names of the state entries (default is an empty string).
A boolean flag, if true keeps the tensors attached to autograd (default is true).
The updated state dictionary containing the module's state.
Zeros out the gradients of all parameters. That can be accomplished either by
setting the grad
property to null
(setToNull=true
) or
by filling the gradient tensor with zeros (setToNull=false
).
whether to set gradients to null
(true
) or to zero tensors (false
).
this module
Generated using TypeDoc
A sequential container.
Modules will be added to it in the order they are passed in the constructor.
The
forward()
method of Sequential accepts any input and forwards it to the first module. It then forwards the output of that module to the second module, and so on, finally returning the output of the last module.