参考 torch、(二) Generators - 云+社区 - 腾讯云
目录
class torch._C.Generator(device='cpu') → Generator
class torch._C.
Generator
(device='cpu') → Generator
Creates and returns a generator object which manages the state of the algorithm that produces pseudo random numbers. Used as a keyword argument in many In-place random sampling functions.
Parameters
device (torch.device
, optional) – the desired device for the generator.
Returns
An torch.Generator object.
Return type