- Deep Learning with PyTorch Quick Start Guide
- David Julian
- 161字
- 2021-07-02 15:00:10
Default value initialization
There are many cases where we need to initialize torch tensors to default values. Here, we create three 2 x 3 tensors, filling them with zeros, ones, and random floating point numbers:

An important point to consider when we are initializing random arrays is the so-called seed of reproducibility. See what happens when you run the preceding code several times. You get a different array of random numbers each time. Often in machine learning, we need to be able to reproduce results. We can achieve this by using a random seed. This is demonstrated in the following code:

Notice that when you run this code many times, the tensor values stay the same. If you remove the seed by deleting the first line, the tensor values will be different each time the code is run. It does not matter what number you use to seed the random number generator, as long as it is consistently, achieves reproducible results.
- 構建高質量的C#代碼
- 21天學通JavaScript
- 三菱FX3U/5U PLC從入門到精通
- Natural Language Processing Fundamentals
- 數控銑削(加工中心)編程與加工
- 深度學習中的圖像分類與對抗技術
- OpenStack Cloud Computing Cookbook(Second Edition)
- 21天學通Java
- PostgreSQL 10 Administration Cookbook
- Red Hat Linux 9實務自學手冊
- Dreamweaver CS6中文版多功能教材
- Working with Linux:Quick Hacks for the Command Line
- 液壓機智能故障診斷方法集成技術
- Visual Studio 2010 (C#) Windows數據庫項目開發
- ZigBee無線通信技術應用開發