code: def let_data_to_variable(
      variable, data, ctx=None, data_name=None, variable_name=None
  ):
      try:
          if data.dtype <= np.float64:
              variable.data.cast(data.dtype)[...] = data
          else:
              variable.d = data
      except:
          if variable.shape != data.shape:
              logger.critical(
                  "Shape does not match between data{} and variable{} ({} != {}).".format(
                      ' "' + data_name + '"' if data_name else "",
                      ' "' + variable_name + '"'
                      if variable_name
                      else "",
                      data.shape,
                      variable.shape,
                  )
              )
          raise
      variable.need_grad = False
  
      # Copy to device
      if ctx:
          try:
              variable.data.cast(variable.data.dtype, ctx)
          except:
              if ctx.array_class != "CpuArray":
                  # Fallback to cpu
                  ctx.array_class = "CpuArray"
                  variable.data.cast(variable.data.dtype, ctx)
              else:
                  raise
  
imports: import os
  import re
  import timeit
  from contextlib import contextmanager
  import nnabla
  import nnabla.utils.callback
  import numpy
  from nnabla.config import nnabla_config
  from nnabla.logger import logger
  from nnabla.utils import nnabla_pb2
  from nnabla.utils.communicator_util import current_communicator
  from nnabla.utils.get_file_handle import get_file_handle_save, get_decorated_file_loader, load_files
  from contextlib import contextmanager
  import nnabla.logger
  from nnabla.lms import SwapInOutScheduler
label_desc: Use image node_id 4 for calling a global function with example usage: let_data_to_variable(variable, data, ctx, data_name, variable_name) without return types