应用
>>> torch.empty(2, 3)
tensor(1.00000e-08 *
[[ 6.3984, 0.0000, 0.0000],
[ 0.0000, 0.0000, 0.0000]])
API
torch.empty(*size, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) → Tensor
参数 | 描述 |
---|---|
size (int…) | |
out (Tensor, optional) | |
dtype (torch.dtype, optional) | |
layout (torch.layout, optional) | |
device (torch.device, optional) | |
requires_grad (bool, optional) | |
pin_memory (bool, optional) | |
memory_format (torch.memory_format, optional) |
参考:
https://pytorch.org/docs/stable/generated/torch.empty.html#torch.empty