What are tensors?
From the book:
“… tensors are ‘just’ multi-dimensional arrays optimized for fast computation - not on the CPU only but also on specialized devices such as GPUs and TPUs.
Load libraries:
Create a tensor:
## [1] 1
Parameters of torch_tensor()
(see help file for this function):
data
dtype
device
requires_grad
pin_memory
Look at the attributes of the tensor:
## torch_Float
## torch_device(type='cpu')
## [1] 1
## Length Class1 Class2 Mode
## 1 torch_tensor R7 externalptr
Change attributes:
## torch_Int