# tensorplay.functional.empty_strided Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.empty_strided.html ```python tensorplay.functional.empty_strided(size, stride, *, dtype=None, layout=None, device=None, requires_grad=False, pin_memory=False) → Tensor ``` Creates a tensor with the specified size and stride and filled with undefined data. > **Warning** > > If the constructed tensor is “overlapped” (with multiple indices referring to the same element in memory) its behavior is undefined. > **Note** > > The returned storage is uninitialized, and tensorplay.use_deterministic_algorithms() does not change that. If the contents matter, allocate with tensorplay.zeros() or fill the tensor before reading it, otherwise the output becomes a source of nondeterminism. Floating point and complex tensors are filled with NaN, and integer tensors are filled with the maximum value. Parameters: - size ([tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple) of [int](https://docs.python.org/3/builtins/functions.html#int)) – the shape of the output tensor - stride ([tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple) of [int](https://docs.python.org/3/builtins/functions.html#int)) – the strides of the output tensor Keyword Arguments: - dtype ([tensorplay.dtype](/docs/generated/tensorplay.DType.html#tensorplay.DType), optional) – the desired data type of returned tensor. Default: if None, uses a global default (see [tensorplay.set_default_dtype()](/docs/generated/tensorplay.set_default_dtype.html#tensorplay.set_default_dtype)). - layout (tensorplay.layout, optional) – the desired layout of returned Tensor. Default: tensorplay.strided. - device ([tensorplay.device](/docs/generated/tensorplay.Device.html#tensorplay.Device), optional) – the desired device of returned tensor. Default: if None, uses the current device for the default tensor type (see [tensorplay.set_default_device()](/docs/generated/tensorplay.set_default_device.html#tensorplay.set_default_device)). device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. - requires_grad ([bool](https://docs.python.org/3/builtins/functions.html#bool), optional) – If autograd should record operations on the returned tensor. Default: False. - pin_memory ([bool](https://docs.python.org/3/builtins/functions.html#bool), optional) – If set, returned tensor would be allocated in the pinned memory. Works only for CPU tensors. Default: False. Example: ``` >>> a = tensorplay.empty_strided((2, 3), (1, 2)) >>> a tensor([[8.9683e-44, 4.4842e-44, 5.1239e+07], [0.0000e+00, 0.0000e+00, 3.0705e-41]]) >>> a.stride() (1, 2) >>> a.size() tensorplay.Size([2, 3]) ```