Function torch::stable::empty#
Defined in File ops.h
Function Documentation#
-
inline torch::stable::Tensor torch::stable::empty(torch::headeronly::IntHeaderOnlyArrayRef size, std::optional<torch::headeronly::ScalarType> dtype = std::nullopt, std::optional<torch::headeronly::Layout> layout = std::nullopt, std::optional<torch::stable::Device> device = std::nullopt, std::optional<bool> pin_memory = std::nullopt, std::optional<torch::headeronly::MemoryFormat> memory_format = std::nullopt)#
Stable version of the empty.memory_format op.
Creates a new uninitialized tensor with the specified size and options. This function supports full tensor creation options including device, dtype, layout, and memory format.
Minimum compatible version: PyTorch 2.10.
- Parameters:
size – The desired size of the output tensor.
dtype – Optional scalar type for the tensor elements.
layout – Optional memory layout (e.g., strided, sparse).
device – Optional device to place the tensor on.
pin_memory – Optional flag to use pinned memory (for CUDA tensors).
memory_format – Optional memory format for the tensor.
- Returns:
A new uninitialized tensor with the specified properties.