class_docstr: Abstract dataset class. All datasets should have this interface.
  
  Subclasses need to override `__getitem__`, which returns the i-th
  element, and `__len__`, which returns the total number elements.
  
  .. note:: An mxnet or numpy array can be directly used as a dataset.
docstr: Returns a new dataset includes only 1/num_shards of this dataset.
  
  For distributed training, be sure to shard before you randomize the dataset
  (such as shuffle), if you want each worker to reach a unique subset.
  
  Parameters
  ----------
  num_shards : int
      A integer representing the number of data shards.
  index : int
      A integer representing the index of the current shard.
  
  Returns
  -------
  Dataset
      The result dataset.
docstr_tok: ["Returns","a","new","dataset","includes","only","1\/num_shards","of","this","dataset",".","For","distributed","training",",","be","sure","to","shard","before","you","randomize","the","dataset","(","such","as","shuffle",")",",","if","you","want","each","worker","to","reach","a","unique","subset",".","Parameters","--","--","--","--","--","num_shards",":","int","A","integer","representing","the","number","of","data","shards",".","index",":","int","A","integer","representing","the","index","of","the","current","shard",".","Returns","--","--","--","-","Dataset","The","result","dataset","."]
code: def shard(self, num_shards, index):
      """Returns a new dataset includes only 1/num_shards of this dataset.
  
      For distributed training, be sure to shard before you randomize the dataset
      (such as shuffle), if you want each worker to reach a unique subset.
  
      Parameters
      ----------
      num_shards : int
          A integer representing the number of data shards.
      index : int
          A integer representing the index of the current shard.
  
      Returns
      -------
      Dataset
          The result dataset.
      """
      assert (
          index < num_shards
      ), f"Shard index of out bound: {index} out of {num_shards}"
      assert num_shards > 0, "Number of shards must be greater than 0"
      assert index >= 0, "Index must be non-negative"
      length = len(self)
      shard_len = length // num_shards
      rest = length % num_shards
      # Compute the start index for this partition
      start = shard_len * index + min(index, rest)
      # Compute the end index for this partition
      end = start + shard_len + (index < rest)
      from . import SequentialSampler
  
      return _SampledDataset(
          self, SequentialSampler(end - start, start)
      )
  
imports: import os
  from ...None import recordio, ndarray
  from ...util import default_array
label_desc: Use image node_id 4 for calling the Dataset obj's underlying member method code with example usage: obj.shard(num_shards, index) and returns: _SampledDataset