当前位置:网站首页>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
边栏推荐
- 4. Load balancing and dynamic static separation
- PHP MySQL where clause
- Computer graduation design PHP sports goods online sales system website
- Grammaire anglaise Nom - Classification
- Redis core technology and practice - learning notes (11): why not just string
- Win32: dump file analysis of heap corruption
- How to draw non overlapping bubble chart in MATLAB
- (9) Opencv Canny edge detection
- 2022-2028 global plasmid DNA cdmo industry research and trend analysis report
- Summary and Reflection on the third week of winter vacation
猜你喜欢
How many convolution methods does deep learning have? (including drawings)
win32:堆破坏的dump文件分析
Micro service component sentinel console call
Have you learned the correct expression posture of programmers on Valentine's day?
Module 9 operation
Grammaire anglaise Nom - Classification
As soon as we enter "remote", we will never regret, and several people will be happy and several people will be sad| Community essay solicitation
2022-2028 global scar care product industry research and trend analysis report
How to expand the capacity of golang slice slice
The vscode code is automatically modified to a compliance code when it is formatted and saved
随机推荐
Niuke monthly race 31 minus integer
win32:堆破坏的dump文件分析
Sepconv (separable revolution) code recurrence
2022-2028 global marking ink industry research and trend analysis report
Nodejs (01) - introductory tutorial
A. Berland Poker & 1000 [simple mathematical thinking]
解决Zabbix用snmp监控网络流量不准的问题
After the festival, a large number of people change careers. Is it still time to be 30? Listen to the experience of the past people
Solve the problem of inaccurate network traffic monitored by ZABBIX with SNMP
2022-2028 global physiotherapy clinic industry research and trend analysis report
Bidding procurement scheme management of Oracle project management system
supervisor监控Gearman任务
PHP MySQL inserts data
Sensor debugging process
Micro service component sentinel console call
[combinatorics] generating function (commutative property | derivative property | integral property)
Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]
webcodecs
Kotlin的協程:上下文
[Godot] add menu button