torch.
numel
Returns the total number of elements in the input tensor.
input
input (Tensor) – the input tensor.
Example:
>>> a = torch.randn(1, 2, 3, 4, 5) >>> torch.numel(a) 120 >>> a = torch.zeros(4,4) >>> torch.numel(a) 16
此页内容是否对您有帮助
感谢反馈!