torch.randint_like¶
- torch.randint_like(input, low=0, high, \*, dtype=None, layout=torch.strided, device=None, requires_grad=False, memory_format=torch.preserve_format) Tensor ¶
返回一个与张量
input
形状相同的张量,并填充从low
(包含)到high
(排除)之间均匀生成的随机整数。- 参数
- 关键字参数
dtype (
torch.dtype
, optional) – 返回张量的所需数据类型。默认值:如果None
,则默认为input
的 dtype。layout (
torch.layout
, optional) – 返回张量的所需布局。默认值:如果None
,则默认为input
的布局。device (
torch.device
, optional) – 返回张量的所需设备。默认值:如果None
,则默认为input
的设备。requires_grad (bool, optional) – 如果 autograd 应该记录在返回的张量上的操作。默认值:
False
。memory_format (
torch.memory_format
, optional) – 返回张量的所需内存格式。默认值:torch.preserve_format
。