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. kernel follows the PyTorch/jax.lax.conv_general_dilated OIHW layout, (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 to from_linear()’s bias-folding convention. Pass the resulting network as conv_block’s patch_net to 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_layer keyword arguments for the bottom (output) layer.

  • layer_kwargs (dict | None) – Extra add_layer keyword arguments for the top (input) layer.

  • network_kwargs (dict | None) – Constructor arguments for the DeepNetwork itself, such as feedforward_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 predict reproduces the convolution kernel’s map over a single im2col-flattened patch.

Return type:

DeepNetwork