pyhgf.model.transplant.from_linear#
- pyhgf.model.transplant.from_linear(linear, leaf_kwargs=None, layer_kwargs=None, network_kwargs=None)[source]#
Build a two-layer network computing exactly
linear(x).The bottom (output) layer has
out_featuresnodes, the top (input) layerin_featuresnodes, and the connecting matrix carries the Linear’s weight with the bias folded in as the last column (if the Linear has one).- Parameters:
linear (Linear) – The Equinox layer whose weights are transplanted.
leaf_kwargs (dict | None) – Extra
add_layerkeyword arguments for the bottom (observed) layer — e.g. the backprop-parity configuration.layer_kwargs (dict | None) – Extra
add_layerkeyword arguments for the top (input) layer.network_kwargs (dict | None) – Constructor arguments for the
DeepNetworkitself, such asfeedforward_uncertainty. These reach the network’s state when it is built and cannot be set afterwards, so they belong here rather than in the per-layer keyword sets.
- Returns:
A network whose
predictreproduces the Linear’s forward pass.- Return type: