latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.func.functional_call
- tensorplay.func.functional_call(module: Module, parameter_and_buffer_dicts: dict[str, Any] | Sequence[dict[str, Any]], args: Any | tuple | None = None, kwargs: dict[str, Any] | None = None, *, tie_weights: bool = True, strict: bool = False)
Runs
modulewith the parameters and buffers given, not its own.The module’s own state is put back afterwards, including if
moduleraises, so this is safe to call on a live model.- Parameters:
module (tensorplay.nn.Module) – the module to call.
parameter_and_buffer_dicts (dict or sequence of dicts) – the state to substitute, keyed by the names
named_parametersandnamed_buffersreport. Several dicts are merged; overlapping keys are an error, since which one wins would be arbitrary.args (Any or tuple) – positional arguments for the module. A non-tuple value is passed as the single argument.
kwargs (dict) – keyword arguments for the module.
tie_weights (bool) – when the module ties two names to one tensor, keep them tied by requiring the replacement to be shared as well. Default:
True.strict (bool) – reject names that the module does not have. Default:
False.
Example
>>> params = dict(model.named_parameters()) >>> functional_call(model, params, (x,))
Help improve this page
Found an error, an unclear step, or a missing example?

