peal.architectures.onnx_predictor.select_onnx_outputs¶
- peal.architectures.onnx_predictor.select_onnx_outputs(src, dst, indices, output_name='output')[source]¶
Write a copy of the classifier at
srcwhose single output islogits[:, indices](aGatheron the last axis), so an N-way model becomes the binary model PEAL analyses. Returnsdst.The corrected model DiDAE exports afterwards is binary as well: it is the finetuned two-class head the user asked to analyse, not the original N-way graph.
- Parameters:
src (
str) – Source.onnxfile.dst (
str) – Destination.onnxfile (written and checked withonnx.checker).indices (
sequenceofint) – At least two distinct output indices, in the order the new outputs should have.output_name (
str) – Name of the new graph output (suffixed_selectedwhen the old output already has that name).
- Returns:
dst.- Return type:
- Raises:
ValueError – If fewer than two distinct indices are given or an index is out of range for a statically shaped output.