TensorPlay

Latest development documentation · Updated 2026-09-08. A documentation snapshot for package 1.0.0.dev20260909 is not available.

On this page

RandomSampler

class tensorplay.utils.data.RandomSampler(data_source: Sized, replacement: bool = False, num_samples: int | None = None, generator: Generator | None = None)[source]

Samples elements randomly. If without replacement, then sample from a shuffled dataset. If with replacement, then user can specify num_samples to draw.

Parameters:
  • data_source (Sized) – data source to sample from. Must implement __len__.

  • replacement (bool) – samples are drawn on-demand with replacement if True, default=``False``.

  • num_samples (int) – number of samples to draw, default=`len(dataset)`.

  • generator (Generator) – Generator used in sampling.

Search documentation

Search all 1,743 documentation pages.

Keyboard shortcuts

Global

  • /Focus search
  • ?This dialog
  • ,Open settings
  • jAI assistant

Search

  • Navigate results
  • Open result
  • escClose

Package

  • mMain information
  • dDocs
  • .Code
  • -Changelog
  • tTimeline
  • sStats
  • vVersions