code: def scatter_kwargs(inputs, kwargs, target_gpus, chunk_sizes, dim=0):
      r"""Scatter with support for kwargs dictionary"""
      inputs = (
          scatter(inputs, target_gpus, chunk_sizes, dim)
          if inputs
          else []
      )
      kwargs = (
          scatter(kwargs, target_gpus, chunk_sizes, dim)
          if kwargs
          else []
      )
      if len(inputs) < len(kwargs):
          inputs.extend([() for _ in range(len(kwargs) - len(inputs))])
      elif len(kwargs) < len(inputs):
          kwargs.extend([{} for _ in range(len(inputs) - len(kwargs))])
      inputs = tuple(inputs)
      kwargs = tuple(kwargs)
      return inputs, kwargs
  
file_path: thu-pacman-faster-moe/examples/transformer-xl/utils/data_parallel.py
imports: from torch.nn.parallel import DataParallel
  import torch
  from torch.nn.parallel._functions import Scatter
  from torch.nn.parallel.parallel_apply import parallel_apply
label_desc: Use image node_id 2 for calling a global function with example usage: scatter_kwargs(inputs, kwargs, target_gpus, chunk_sizes, dim) and returns: inputs,  kwargs