code: def move_to_device(item, device, criterion_func):
      """
      Move tensor on to specified device by changing the storage.
      Works on individual tensors, and tensors contained/nested in lists, tuples, and dicts.
      Parameters:
          item: tensor to move or (possibly nested) container of tensors to move.
          device: target device
          criterion_func: Function to restrict move operation to items meet criterion
  
      Returns:
          None
      """
      if criterion_func(item):
          device_copy = item.to(device)
          item.data = device_copy.data
          return item
      elif isinstance(item, list):
          return [
              move_to_device(v, device, criterion_func) for v in item
          ]
      elif isinstance(item, tuple):
          return tuple(
              [move_to_device(v, device, criterion_func) for v in item]
          )
      elif isinstance(item, dict):
          return {
              k: move_to_device(v, device, criterion_func)
              for k, v in item.items()
          }
      else:
          return item
  
imports: from collections.abc import Iterable
  from deepspeed.moe.utils import is_moe_param
  import os
  import psutil
  import gc
  from math import sqrt
  from math import floor
  from bisect import bisect_left
  import torch
  from torch import inf
  from deepspeed import comm
  from deepspeed.utils import groups, logger
  from deepspeed.runtime.constants import PIPE_REPLICATED
  from numpy import prod
label_desc: Use image node_id 7 for calling a global function with example usage: move_to_device(item, device, criterion_func) and returns: item, unknown, tuple, unknown, item