incerto.ood.extract_features#
- incerto.ood.extract_features(model, data_loader, layer_name='penultimate')[source]#
Extract features from a specific layer of the model.
Uses
str.endswithmatching on module names, consistent with the hook mechanism inMahalanobisandKNN.- Parameters:
model (
Module) – PyTorch model.data_loader (
DataLoader) – DataLoader containing input data.layer_name (
str) – Name (suffix) of layer to extract features from.
- Return type:
- Returns:
Tensor of extracted features.