torch.numel¶ torch.numel(input: Tensor) → int¶ 傳回 input tensor 中的元素總數。 參數 input (Tensor) – 輸入 tensor。 範例 >>> a = torch.randn(1, 2, 3, 4, 5) >>> torch.numel(a) 120 >>> a = torch.zeros(4,4) >>> torch.numel(a) 16