code: def test_with_task_labels(self):
      exps = []
  
      tx = torch.rand(10, 17)
      ty = torch.randint(0, 2, (10,))
      t_tl = torch.tensor([0 for _ in range(10)])
      data = _make_taskaware_tensor_classification_dataset(
          tx, ty, task_labels=t_tl
      )
      exps.append(DatasetExperience(dataset=data))
  
      t_tl = torch.tensor([7 for _ in range(10)])
      data = _make_taskaware_tensor_classification_dataset(
          tx, ty, task_labels=t_tl
      )
      exps.append(DatasetExperience(dataset=data))
  
      stream = EagerCLStream(name="train", exps=exps)
      bm = CLScenario([stream])
      bm = with_task_labels(bm)
  
      assert len(bm.streams) == 1
      stream = bm.train_stream
  
      # exp 0 has tl==0
      tls = stream[0].task_labels
      self._assert_is_unique_and_int(tls)
      assert stream[0].task_label == 0
  
      # exp 1 has tl==7
      tls = stream[1].task_labels
      self._assert_is_unique_and_int(tls)
      assert stream[1].task_label == 7
  
file_path: avalanche/tests/benchmarks/scenarios/test_experience_decorators.py
imports: import unittest
  import torch
  from avalanche.benchmarks import benchmark_from_datasets, EagerCLStream, CLScenario
  from avalanche.benchmarks import DatasetExperience
  from avalanche.benchmarks.scenarios.task_aware import with_task_labels
  from avalanche.benchmarks.scenarios.supervised import with_classes_timeline
  from avalanche.benchmarks.utils import _make_taskaware_tensor_classification_dataset
label_desc: Use image node_id 2 for calling the ExperienceDecoratorTests obj's underlying member method code with example usage: obj.test_with_task_labels() without return types