Learn R Programming

rTorch (version 0.4.2)

length.torch.Tensor: Length of a tensor.

Description

This function is equivalent to torch$numel()

Usage

# S3 method for torch.Tensor
length(x)

Arguments

x

tensor

Value

the number of elements of a tensor as an integer

Examples

Run this code
# NOT RUN {
uo = torch$ones(3L, 5L)   # tensor with 15 elements
length(uo)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab