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 use fill_ (value) in torch.tensor

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

Share

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

How to use fill_ (value) in torch.tensor? aiming at 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 lab code 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.manual_seed (seed=20200910) > a = torch.randn (3CM4) > > 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]) > > a.fill2020.0910 tensor ([[2020.0909, 2020.0909, 2020.0909, 2020.0909], [2020.0909, 2020.0909, 2020.0909, 2020.0909], [2020.0909, 2020.0909, 2020.0909]) > > atensor ([2020.0909, 2020.0909, 2020.0909) 2020.0909], [2020.0909, 2020.0909, 2020.0909, 2020.0909], [2020.0909, 2020.0909, 2020.0909, 2020.0909]) > > a [0memo] tensor (2020.0909) > > a [0re0] .item () 2020.0909423828125 > this is the answer to the question on how to use fill_ (value) in torch.tensor. 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

  • Word Export html to realize online Preview

    The required maven dependencies are compiled and must be consistent with the version:

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

    12
    Report