code: def np_to_xshards(data, workers_num):
      from bigdl.orca.data import XShards
  
      _shards = XShards.partition(data)
      if (
          math.floor(math.sqrt(math.sqrt(_shards.num_partitions())))
          > workers_num
      ):
          warnings.warn(
              "Too many partitions and too few workers will reduce inference performance, "
              "we recommend setting 'workers_per_node' to a large number and",
              "not larger than the number of partitions.",
              category=RuntimeWarning,
          )
  
      def transform_to_dict(data):
          return {"x": data}
  
      return _shards.transform_shard(transform_to_dict)
  
file_path: BigDL/python/chronos/src/bigdl/chronos/forecaster/tf/utils.py
imports: import tensorflow
  import numpy
  import math
  import warnings
label_desc: Use image node_id 4 for calling a global function with example usage: np_to_xshards(data, workers_num) and returns: _shards, dict