dataeval.utils.onnx.find_embedding_layer

dataeval.utils.onnx.find_embedding_layer(model_path)

Find the embedding layer name in an ONNX classification model.

For classification models like ResNet, this identifies the layer that produces embeddings (feature vectors) before the final classification layer. This is typically the input to the last fully-connected (Gemm) layer or the output of a GlobalAveragePool layer.

Parameters:
model_path : str or Path

Path to the ONNX model file.

Returns:

Name of the embedding layer output.

Return type:

str

Raises:
  • ImportError – If the onnx package is not installed.

  • ValueError – If the embedding layer cannot be identified.