当前位置:网站首页>How to build a deep learning framework?
How to build a deep learning framework?
2022-06-21 08:08:00 【AI kasha】
At present, the framework of deep learning is becoming more and more mature , For users, the degree of encapsulation is higher and higher , The advantage is that these frameworks can now be used as tools very quickly , Experiments can be carried out with very little code , The disadvantage is that the implementation behind the possibility is hidden . In this article, the author will take you to design and implement a lightweight ( about 200 That's ok )、 Easy to extend deep learning framework tinynn, I hope it will be helpful for you to understand the basic design and implementation of the deep learning framework .
This paper will first analyze the process of deep learning , Abstract the key components in neural network , Determine the basic framework ; Then code the components in the framework ; Finally, based on this framework, a MNIST Examples of classification .
Component abstraction
First, consider the flow of neural network operation , Neural network operation mainly includes training training And forecasting predict ( or inference) Two phases ,
The basic process of training is : input data -> Network layer forward propagation -> Calculate the loss -> Network layer back propagation gradient -> Update parameters ;
The basic process of forecasting is input data -> Network layer forward propagation -> Output results .

From an operational point of view , There are three main types of calculations :
Data flows directly at the network layer
Forward propagation and back propagation can be regarded as tensors Tensor( Multidimensional arrays ) Flow between network layers ( The forward propagating flow is the input and output , The of backward propagating flow is gradient ), Each network layer will perform certain operations , Then input the results to the next layer .
Calculate the loss
The intermediate process of connecting forward and backward propagation , Defines the difference between the output of the model and the real value , Used to provide the information needed for back propagation
Parameters are updated
A kind of calculation that uses the calculated gradient to update the network parameters
Based on these three types , We can make an abstraction of the basic components of the network
tensor tensor , This is the basic unit of data in neural network
layer The network layer , Be responsible for receiving the input from the upper layer , Perform the operation of this layer , Output the result to the next layer , because tensor There are two directions of flow: forward and reverse , Therefore, for each type of network layer, we need to implement forward and backward Two operations
loss Loss , After given the predicted value and real value of the model , The component outputs the loss value and the gradient about the last layer ( Used for gradient return )
optimizer Optimizer , Responsible for updating the parameters of the model using gradients
Then we need some components to put the above 4 Integrate... Basic components together , To form a pipeline
net The component is responsible for managing tensor stay layer Forward and backward propagation between , At the same time, it can provide acquisition parameters 、 Set parameters 、 Get the interface of gradient
model Component is responsible for integrating all components , The formation of the pipeline. namely net Component forward propagation -> loss Components calculate losses and gradients -> net The component will propagate the gradient back -> optimizer The component updates the gradient to the parameter .
Share some of my artificial intelligence learning materials for free , Including some AI Common framework actual combat video 、 Image recognition 、OpenCV、NLQ、 machine learning 、pytorch、 Computer vision 、 Videos such as deep learning and neural network 、 Courseware source code 、 Famous essence resources at home and abroad 、AI Hot papers 、 Industry reports, etc .
For better systematic learning AI, I recommend that you collect one .
Here are some screenshots , Click here to download the materials for free .
One 、 Artificial intelligence courses and projects

Two 、 Famous essence resources at home and abroad

3、 ... and 、 Collection of papers on artificial intelligence

Four 、 AI Industry Report

Learn Artificial Intelligence well , Read more , Do more , practice , If you want to improve your level , We must learn to settle down and learn slowly and systematically , Only in the end can we gain something .
Small partners in need , Click here to download the materials for free .
边栏推荐
- A table to easily understand the prefix and suffix of increment and decrement operators
- (for line breaks) differences between gets and fgets, and between puts and fputs
- Matlab 3D diagram (unconventional)
- 图解 Google V8 # 14:字节码(二):解释器是如何解释执行字节码的?
- antd table长表格如何出现滚动条
- Qunhui dsm7 add kit source
- [Redis]-[Redis底层数据结构]-SDS
- 2021-07-28 STM32F103 configuration information
- Leetcode topic [array] -40- combined sum II
- Talk about MySQL's locking rule "hard hitting MySQL series 15"
猜你喜欢

2021-06-16 STM32F103 EXTI 中断识别 使用固件库

Figure neural network and cognitive reasoning - Tang Jie - Tsinghua University

Bean实例化的三种方法

2022-2028 global section valve industry research and trend analysis report
![[untitled]](/img/25/4725977134d41b5d6f5d86b60ec731.jpg)
[untitled]

Mongodb installation (Graphic tutorial)

Definition and declaration problems in stm32

JVM memory model concepts

【元宇宙3d大赛】

Cobaltstrike office macro virus utilization
随机推荐
Antique typesetting (20 points) (test point 4)
LeetCode数组经典题目(一)
Le Code est correct, mais les données de la base de données ne sont pas affichées.
1005 spell it right (20 points) (test point 3)
How to make MySQL case insensitive
[redis]-[redis underlying data structure] - Dictionary
华三IPsec
Definition and declaration problems in stm32
1006 sign in and sign out (25 points)
一元多项式的乘法与加法运算 (20 分)
2021-07-28 STM32F103 I2C Hardware Transfer Include previous IO Clock EXIT USB use firmware library
Rdkit | compound library based on murcko skeleton clustering
MySql 过滤查询(以字母开头,以数字开头,非数字开头,非字母开头)
Redis cache use case
解决Jenkins升级后不能保存配置的问题
[Redis]-[Redis底层数据结构]-字典
Eureka的TimedSupervisorTask类(自动调节间隔的周期性任务)
图解 Google V8 # 15:隐藏类:如何在内存中快速查找对象属性?
Global and Chinese market for crankshaft position sensors 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of horizontal drilling rigs 2022-2028: Research Report on technology, participants, trends, market size and share