Shortcuts

mmedit.models.utils.noise_sample_fn

mmedit.models.utils.noise_sample_fn(noise: Optional[Union[torch.Tensor, Callable]] = None, *, num_batches: int = 1, noise_size: Optional[Union[int, Sequence[int]]] = None, device: Optional[str] = None) torch.Tensor[source]

Sample noise with respect to the given num_batches, noise_size and device.

Parameters
  • noise (torch.Tensor | callable | None) – You can directly give a batch of noise through a torch.Tensor or offer a callable function to sample a batch of noise data. Otherwise, the None indicates to use the default noise sampler. Defaults to None.

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

  • noise_size (Union[int, Sequence[int], None], optional) – The size of random noise. Defaults to None.

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

Returns

Sampled random noise.

Return type

Tensor

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.