peal.architectures.onnx_predictor.find_final_linear¶
- peal.architectures.onnx_predictor.find_final_linear(path)[source]¶
Locate the classifier’s final linear layer in an ONNX graph.
Walks back from the (single) graph output through pass-through ops and at most one constant-index
Gatheron the last axis (the output selectionselect_onnx_outputs()adds) to aGemm, or aMatMuloptionally followed by anAdd, whose weight (and bias) are initializers.- Parameters:
path (
str) –.onnxfile.- Returns:
Nonewhen no such layer is found; otherwisenode(name of the Gemm / MatMul),op,feature_tensor(its data input),weight/bias(initializer names, biasNoneif absent),add_node(the bias Add of a MatMul, orNone),weight_layout("class_major"for[C, F],"feature_major"for[F, C]),n_features,n_classesandselected(the class indices the output Gather picks, orNonefor all classes).- Return type: