def extract_feature(inception_model, images):
    """Extracts feature from input images with given model.

    NOTE: The input images are assumed to be with pixel range [-1, 1].

    Args:
        inception_model: The model used to extract features.
        images: The input image tensor to extract features from.

    Returns:
        A `numpy.ndarray`, containing the extracted features.
    """
    features = inception_model(images, output_logits=False)
    features = features.detach().cpu().numpy()
    assert features.ndim == 2 and features.shape[1] == 2048
    return features
Extracts feature from input images with given model.

    NOTE: The input images are assumed to be with pixel range [-1, 1].

    Args:
        inception_model: The model used to extract features.
        images: The input image tensor to extract features from.

    Returns:
        A `numpy.ndarray`, containing the extracted features.
    
metrics/fid.py