code: def test_dataset_to_copy_with_target_labels_explicit(self):
      ds = random_transformer_dataset(10, target_labels="explicit")
      ds = ds.to("cpu")
      self.assertTrue(
          np.all(
              [
                  item[TransformersDataset.INDEX_TEXT].device
                  == torch.device("cpu")
                  for item in ds.data
              ]
          )
      )
  
      ds_new = ds.to("cuda", copy=True)
      self.assertTrue(
          np.all(
              [
                  item[TransformersDataset.INDEX_TEXT].device.type
                  == "cuda"
                  for item in ds_new.data
              ]
          )
      )
  
      # test for object equality
      num_target_labels = ds.target_labels.shape[0]
      ds._target_labels = np.delete(ds.target_labels, 0)
      self.assertTrue(
          ds_new.target_labels.shape[0] == num_target_labels
      )
  
file_path: small-text/tests/integration/small_text/integrations/transformers/test_datasets.py
imports: import unittest
  import pytest
  import numpy
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
label_desc: Use image node_id 6 for calling the TransformersDatasetTest obj's underlying member method code with example usage: obj.test_dataset_to_copy_with_target_labels_explicit() without return types