File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,29 @@ def sample_from(
134134 batch_size : int = 32 ,
135135 shuffle : Optional [bool ] = False ,
136136 ) -> "Batch" :
137+ """Sample a batch from a dataset or a loader.
138+
139+ Example usage::
140+ dataset = merlin.io.Dataset(...)
141+ batch = Batch.sample_from(dataset)
142+
143+ Parameters
144+ ----------
145+ dataset_or_loader: merlin.io.dataset
146+ A Dataset object or a Loader object.
147+ batch_size: int, default=32
148+ Number of samples to return.
149+ shuffle: bool
150+ Whether to sample a random batch or not, by default False.
151+
152+ Returns:
153+ -------
154+ features: Dict[torch.Tensor]
155+ dictionary of feature tensors.
156+ targets: Dict[torch.Tensor]
157+ dictionary of target tensors.
158+ """
159+
137160 return sample_batch (dataset_or_loader , batch_size , shuffle )
138161
139162 def replace (
You can’t perform that action at this time.
0 commit comments