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

What is the simple and practical method of Python torch.tensor ()

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

Share

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

This article mainly introduces "what is the simple and practical method of Python torch.tensor ()". In daily operation, I believe that many people have doubts about the simple and practical method of Python torch.tensor (). The editor consulted all kinds of materials and sorted out simple and useful operation methods, hoping to help you answer the doubts of "what is the simple and practical method of Python torch.tensor ()?" Next, please follow the editor to study!

The code experiment shows:

Microsoft Windows [version 10.0.18363.1256] (c) 2019 Microsoft Corporation. All rights reserved. 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.tensor 1.2000]) # receive data from the list tensor ([[0.1000, 1.2000], [2.2000, 3.1000], [4.9000, 5.2000]]) > torch.tensor ([0,1]) # Type inference on data infers the type to be used tensor ([0,1]) > torch.tensor ([[0.11111, 0.222222, 0.3333333]) from the data types in the list. Dtype=torch.float64,... Device=torch.device ('cuda:0') # creates a torch.cuda.DoubleTensortensor ([[0.1111, 0.2222, 0.3333]], device='cuda:0', dtype=torch.float64) > torch.tensor (3.14159) # Create a scalar (zero-dimensional tensor) tensor (3.1416) > # create a scalar > torch.tensor ([]) # Create an empty tensor (of size (0) ) tensor ([]) > print (torch.__version__) 1.2.0+cu92 > print (torch.cuda.is_available ()) True > so far The study on "what is the simple and practical method of Python torch.tensor ()" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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