PyTorch torch.empty Function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.emptyis a function in PyTorch used to create uninitialized tensors.

Function Definition

torch.empty(*size, dtype=None, device=None, requires_grad=False)

Usage Example

Example

import torch

# Create an uninitialized tensor
x = torch.empty(3, 4)

print(x)
print("Note: The values are uninitialized memory values")

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions