Boostcamp AI tech 3기/개념 이해

torch Tensor 크기 구하기 torch.numel()

mcdn 2022. 1. 26. 11:02
반응형

TORCH.NUMEL

torch.numel(input)  int

Returns the total number of elements in the input tensor.

 

torch Tensor의 텐서 크기 구하기 

torch.numel() 함수 

 

>>> a = torch.randn(1, 2, 3, 4, 5)
>>> torch.numel(a)
120
>>> a = torch.zeros(4,4)
>>> torch.numel(a)
16
반응형