当前位置:网站首页>Torch learning notes (4) -- torch's dynamic calculation diagram
Torch learning notes (4) -- torch's dynamic calculation diagram
2022-07-03 18:22:00 【ZRX_ GIS】
import torch
import numpy as np
import matplotlib.pyplot as plt
# Calculation chart (Computer Graph) Is a directed acyclic graph used to describe operations
# CG There are two main elements : node (Node)、 edge (Edge)
# Node According to the data
# Edge Representation operation
# If you want to use non leaf Gradient of nodes . You need to call before back propagation .retain_grad()
# CG effect : Convenient gradient calculation and back propagation
# Case study
# y = (x+w)(w+1), Then when w=1,x=2 when ,y Yes w Of grad How much is the ?
w = torch.tensor([1.], requires_grad=True)
x = torch.tensor([2.], requires_grad=True)
a = torch.add(w, x)
b = torch.add(w, 1)
y = torch.mul(a, b)
y.backward()
# Can pass .grad Determine whether the variable has grad, After the end of back propagation, it is not leaf Nodal grad Will be released
print(w.grad)
# grad_fn Used to record the creation of tensor Used in function, The essence is to record Edge
print(y.grad_fn)
# according to CG Construction method , Can be CG It is divided into dynamic graph and static graph
# Dynamic graph (Dynamic Graph) Operation and loading are carried out at the same time , self-driving tours
# Static diagram (Computation Graph) First loading diagram , Post operation , Travel with a group
边栏推荐
- AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]
- [enumeration] annoying frogs always step on my rice fields: (who is the most hateful? (POJ hundred practice 2812)
- Bloom filter [proposed by bloom in 1970; redis cache penetration solution]
- Change the single node of Postgres database into master-slave
- 2022-2028 global plasmid DNA cdmo industry research and trend analysis report
- PHP MySQL create database
- Sepconv (separable revolution) code recurrence
- A. Odd Selection【BruteForce】
- 189. Rotation array
- (8) HS corner detection
猜你喜欢

Summary and Reflection on the third week of winter vacation

Have you learned the correct expression posture of programmers on Valentine's day?

Bidding procurement scheme management of Oracle project management system

BFS - topology sort

Valentine's day, send you a little red flower~
![网格图中递增路径的数目[dfs逆向路径+记忆dfs]](/img/57/ff494db248171253996dd6c9110715.png)
网格图中递增路径的数目[dfs逆向路径+记忆dfs]

What London Silver Trading software supports multiple languages

Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time

Why can deeplab v3+ be a God? (the explanation of the paper includes super detailed notes + Chinese English comparison + pictures)

How to draw non overlapping bubble chart in MATLAB
随机推荐
2022-2028 global scar care product industry research and trend analysis report
Prototype inheritance..
WebView module manages the application window interface to realize the logical control and management operation of multiple windows (Part 1)
How to track the real-time trend of Bank of London
Change the single node of Postgres database into master-slave
Line by line explanation of yolox source code of anchor free series network (5) -- mosaic data enhancement and mathematical understanding
Supervisor monitors gearman tasks
This diversion
Codeforces Round #803 (Div. 2) C. 3SUM Closure
[combinatorics] exponential generating function (example 2 of solving multiple set permutation with exponential generating function)
An academic paper sharing and approval system based on PHP for computer graduation design
Computer graduation project PHP library book borrowing management system
Install apache+php+mysql+phpmyadmin xampp and its error resolution
Introduction to PHP MySQL
AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]
Codeforces Round #803 (Div. 2) C. 3SUM Closure
Image 24 bit depth to 8 bit depth
[combinatorics] generating function (example of using generating function to solve the number of solutions of indefinite equation)
Use of unsafe class
Recent learning experience