Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze the usage examples of torch.mean () and mean (dim=None, keepdim=False)

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to analyze with examples of torch.mean () and mean (dim=None, keepdim=False). For this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

The code experiment shows:

Microsoft Windows [version 10.0.18363.1256] (c) 2019 Microsoft Corporation. All rights reserved. C:\ Users\ chenxuqi > C:\ Users\ chenxuqi > conda activate ssd4pytorch2_2_0 (ssd4pytorch2_2_0) C:\ Users\ chenxuqi > 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) > > a = torch.randn (4,3) > > atensor ([[0.2824,-0.3715)] 0.9088], [- 1.7601,-0.1806, 2.0937], [1.0406,-1.7651, 1.1216], [0.8440, 0.1783, 0.6859]) > torch.mean (a) tensor (0.2565) > atensor ([[0.2824,-0.3715,0.9088], [- 1.7601,-0.1806,2.0937], [1.0406,-1.7651,1.1216], [0.8440] 0.1783, 0.6859]) > > torch.mean (a, 1) tensor ([0.2732, 0.0510, 0.1324, 0.5694]) > > torch.mean (a, 0) tensor ([0.1017,-0.5347, 1.2025]) > torch.mean (input=a, dim=0, keepdim=False) tensor ([0.1017,-0.5347,1.2025]) > torch.mean (input=a, dim=1, keepdim=False) tensor ([0.2732,0.0510,0.1324]) 0.5694]) > torch.mean (input=a, dim=0, keepdim=True) tensor ([0.1017,-0.5347, 1.2025]]) > > torch.mean (input=a, dim=1, keepdim=True) tensor ([[0.2732], [0.0510], [0.1324], [0.5694]]) > on the use of torch.mean () and mean (dim=None, keepdim=False) examples of how to analyze questions are shared here. I hope the above content can help you to a certain extent, if you still have a lot of doubts to be solved, you can follow the industry information channel to learn more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report