参考链接: torch.numel(input) → int
参考链接: numel() → int
函数使用说明:torch.numel(input) → int返回输入张量input的元素总数 Microsoft Windows [版本 10.0.18363.1256](c) 2019 Microsoft Corporation。保留所有权利。C:Userschenxuqi>conda activate ssd4pytorch1_2_0(ssd4pytorch1_2_0) C:Userschenxuqi>pythonPython 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32Type "help", "copyright", "credits" or "license" for more information.>>> import torch>>> torch.manual_seed(seed=20200910)<torch._C.Generator object at 0x0000021CCA53D330>>>>>>> a = torch.randn(1, 2, 3, 4, 5)>>> a.numel()120>>> torch.numel(a)120>>>>>>>>> a = torch.zeros(4,4)>>> a.numel()16>>>>>>>>> torch.numel(a)16>>>>>>>>>