peal.architectures.onnx_predictor.write_final_linear

peal.architectures.onnx_predictor.write_final_linear(src, dst, info, weight, bias)[source]

Replace the final layer’s weights for the selected classes.

Parameters:
  • src (str) – Source and destination .onnx files.

  • dst (str) – Source and destination .onnx files.

  • info (dict) – find_final_linear() of src.

  • weight (array-like, shape (k, n_features)) – New weight rows, one per selected class (info["selected"], or all classes when nothing is selected), in output order.

  • bias (array-like, shape (k,)) – New biases. A MatMul without bias gets an Add with a new bias initializer (zero for the classes that are not replaced).

Returns:

dst.

Return type:

str