def update(self, features: torch.Tensor, group: str | None = None) -> None:
        """Update the internal feature bank while keeping track of the group.

        Args:
            features (torch.Tensor): Feature vectors extracted from a video frame of
                shape ``(N, D)``.
            group (str | None, optional): Identifier of the group (video) from which
                the frame was sampled. Defaults to ``None``.

        Example:
            >>> estimator = GroupedKNNEstimator(n_neighbors=5)
            >>> features = torch.randn(32, 512)  # (N, D)
            >>> estimator.update(features, group="video_1")
        """
        group = group or "default"

        if group in self.feature_collection:
            self.feature_collection[group].append(features)
        else:
            self.feature_collection[group] = [features]
Update the internal feature bank while keeping track of the group.

        Args:
            features (torch.Tensor): Feature vectors extracted from a video frame of
                shape ``(N, D)``.
            group (str | None, optional): Identifier of the group (video) from which
                the frame was sampled. Defaults to ``None``.

        Example:
            >>> estimator = GroupedKNNEstimator(n_neighbors=5)
            >>> features = torch.randn(32, 512)  # (N, D)
            >>> estimator.update(features, group="video_1")
        
src/anomalib/models/video/ai_vad/density.py