powered by
Converts R objects to a torch tensor
torch_tensor( data, dtype = NULL, device = NULL, requires_grad = FALSE, pin_memory = FALSE )
an R atomic vector, matrix or array
a torch_dtype instance
a device creted with torch_device()
torch_device()
if autograd should record operations on the returned tensor.
If set, returned tensor would be allocated in the pinned memory.
if (torch_is_installed()) { torch_tensor(c(1, 2, 3, 4)) torch_tensor(c(1, 2, 3, 4), dtype = torch_int()) }
Run the code above in your browser using DataLab