code: def randomize_like_with_shape(shape, ori_t):
      """
      Return a new random tensor like the original
      tensor.
      """
      assert isinstance(ori_t, torch.Tensor)
      device = ori_t.device
      dtype = ori_t.dtype
      require_grad = ori_t.requires_grad
      lower_bound = torch.min(ori_t)
      higher_bound = torch.max(ori_t)
  
      if dtype in torch_integer_dtype:
          return torch.randint(
              lower_bound.long(),
              higher_bound.long() + 1,
              shape,
              dtype=dtype,
              device=device,
          )
      else:
          return torch.rand(
              shape,
              dtype=dtype,
              device=device,
              requires_grad=require_grad,
          )
  
file_path: nni/nni/compression/speedup/utils.py
imports: from copy import deepcopy
  import logging
  from typing import Any, Dict, List, Tuple
  import torch
  from torch.fx.immutable_collections import immutable_dict, immutable_list
  from torch.utils._pytree import tree_map, tree_flatten, tree_unflatten, _register_pytree_node, Context
label_desc: Use image node_id 7 for calling a global function with example usage: randomize_like_with_shape(shape, ori_t) and returns: torch, torch