code: def to_tensor(
      ndarray, requires_grad=False
  ):  # return a float tensor by default
      tensor = torch.from_numpy(
          ndarray
      ).float()  # by default does not require grad
      if requires_grad:
          tensor.requires_grad_()
      return tensor.cuda() if torch.cuda.is_available() else tensor
  
file_path: auptimizer/src/aup/compression/torch/pruning/amc/lib/utils.py
imports: import os
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: to_tensor(ndarray, requires_grad) and returns: unknown