Shortcuts

mmedit.models.utils.label_sample_fn

mmedit.models.utils.label_sample_fn(label: Optional[Union[torch.Tensor, Callable, List[int]]] = None, *, num_batches: int = 1, num_classes: Optional[int] = None, device: Optional[str] = None) Optional[torch.Tensor][source]

Sample random label with respect to num_batches, num_classes and device.

Parameters
  • label (Union[Tensor, Callable, List[int], None], optional) – You can directly give a batch of label through a torch.Tensor or offer a callable function to sample a batch of label data. Otherwise, the None indicates to use the default label sampler. Defaults to None.

  • num_batches (int, optional) – The number of batch size. Defaults to 1.

  • num_classes (Optional[int], optional) – The number of classes. Defaults to None.

  • device (Optional[str], optional) – The target device of the label. Defaults to None.

Returns

Sampled random label.

Return type

Union[Tensor, None]

Read the Docs v: zyh/doc-notfound-extend
Versions
master
latest
stable
zyh-doc-notfound-extend
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.