code: def test__reset_features_and_targets(self) -> None:
      train_features = torch.randn(4, 3)
      train_targets = torch.randint(0, 10, (4,))
      train_dataset = _FeaturesDataset(
          features=train_features, targets=train_targets
      )
      val_features = torch.randn(4, 3)
      val_targets = torch.randint(0, 10, (4,))
      val_dataset = _FeaturesDataset(
          features=val_features, targets=val_targets
      )
      train_dataloader = DataLoader(train_dataset)
      val_dataloader = DataLoader(val_dataset)
      classifier = KNNClassifier(nn.Identity(), num_classes=10, knn_k=3)
  
      trainer = Trainer(max_epochs=2, accelerator="cpu", devices=1)
      trainer.fit(
          model=classifier,
          train_dataloaders=train_dataloader,
          val_dataloaders=val_dataloader,
      )
  
      # Check that train features and targets are reset after validation.
      assert classifier._train_features == []
      assert classifier._train_targets == []
      assert classifier._train_features_tensor is not None
      assert classifier._train_targets_tensor is not None
      # Check that train features and targets are not accumulated over multiple
      # validation epochs.
      assert classifier._train_features_tensor.shape == (3, 4)
      assert classifier._train_targets_tensor.shape == (4,)
  
      # Check that train features and targets are not accumulated over multiple
      # training epochs.
      trainer = Trainer(max_epochs=2, accelerator="cpu", devices=1)
      trainer.fit(model=classifier, train_dataloaders=train_dataloader)
      assert len(classifier._train_features) == 4
      assert len(classifier._train_targets) == 4
  
imports: from typing import Tuple
  import pytest
  import torch
  from pytest_mock import MockerFixture
  from pytorch_lightning import Trainer
  from torch import Tensor, nn
  from torch.utils.data import DataLoader, Dataset
  from lightly.utils.benchmarking import KNNClassifier
  from lightly.utils.benchmarking.knn_classifier import F
label_desc: Use image node_id 7 for calling the TestKNNClassifier obj's underlying member method code with example usage: obj.test__reset_features_and_targets() without return types