Returns a tensor filled with uninitialized data.

tch_empty(sizes, dtype = NULL, layout = NULL, device = NULL,
  requires_grad = FALSE)

Arguments

sizes

a sequence of integers defining the shape of the output tensor.

dtype

the desired data type of returned tensor. Default: if NULL, infers data type from x.

device

the desired device of returned tensor. Default: if NULL, uses the current device for the default tensor type (see tch_set_default_tensor_type()). device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types.

requires_grad

If autograd should record operations on the returned tensor. Default: FALSE.

the

desired layout of returned Tensor. Default: 'strided'

Details

The shape of the tensor is defined by the variable argument sizes.

Examples

tch_empty(c(2, 2))
#> tensor #> 1e-10 * #> 0.0000 4.6566 #> -2870932006835.9375 0.0000 #> [ Variable[CPUFloatType]{2,2} ]