pyhgf.model.transplant.from_conv#
- pyhgf.model.transplant.from_conv(kernel, bias=None, leaf_kwargs=None, layer_kwargs=None, network_kwargs=None)[source]#
Build a shared-kernel network holding a transplanted convolution kernel.
Has the shape
conv_patch_network()builds fresh.kernelfollows the PyTorch/jax.lax.conv_general_dilatedOIHWlayout,(out_channels, in_channels, kh, kw); it is flattened channel-major-then-spatial (pyhgf.model.conv’s patch convention) to match the row a shared kernel is applied to, then handed tofrom_linear()’s bias-folding convention. Pass the resulting network asconv_block’spatch_netto place it in a full pipeline.- Parameters:
kernel (Array) – Convolution weights,
(out_channels, in_channels, kh, kw).bias (Array | None) – Optional per-output-channel bias.
leaf_kwargs (dict | None) – Extra
add_layerkeyword arguments for the bottom (output) layer.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 convolution kernel’s map over a singleim2col-flattened patch.- Return type: