_check_forward_outputs#

skactiveml.utils._check_forward_outputs(forward_outputs)[source]#

Validate the forward_outputs mapping used by SkorchMixin.

Parameters:
forward_outputsdict[str, tuple[int, Callable | None]]

Mapping that describes how to obtain and post-process the outputs of module.forward for prediction.

Given raw_outputs = module.forward(X), each entry name -> (idx, transform) is interpreted as:

  • idx: integer index of raw_outputs (0-based).

  • transform: callable f(tensor) -> tensor or None. If transform is not None, it is applied to the selected raw tensor; otherwise the raw tensor is used.

Raises:
TypeError

If forward_outputs is not a dictionary or contains invalid entry specifications.

ValueError

If forward_outputs is empty or contains negative indices.