当前位置:网站首页>The overall construction process of the Tensorflow model
The overall construction process of the Tensorflow model
2022-08-09 23:12:00 【phac123】
Article table of contents
TF construct eight-part text
- Import: import related packages
- train and test: Process the training and test data sets, including out-of-order operations
- models.Sequential: Building Network Models
- model.compile: Set the optimization algorithm, configure the training method
- model.fit: Set the learning rate during training, the number of iterations, batch_size, and train the model;
- model.summary: print out network structure and parameter statistics
Simple implementation
# 1. importimport tensorflow as tf# 2. train and testw = tf.Variable(tf.constant(5, dtype=tf.float32))# 3. model.sequential# 4. model.compile and 5. model.fitlr = 0.2epochs = 40for epoch in range(epochs):with tf.GradientTape() as tape:loss = tf.square(w + 1) # define lossfunctiongrads = tape.gradient(loss, w) # Find the gradient of loss to ww.assign_sub(lr * grads)print("After %s epoch, w is %f, loss is%f" % (epoch,w.numpy(), loss)) # 6. model.summary()
边栏推荐
- 基于Docker构建MySQL主从复制数据库
- 消防安全培训|“蓝朋友”,开课了!
- MySQL跨表、多表更新SQL语句总结
- Interviewer: How to deal with Redis big key?
- Byte side: Can TCP and UDP use the same port?
- LeetCode26: remove duplicates in sorted array
- 威纶通触摸屏制作自定义弹出窗口的具体方法(3种)
- 论文解读(DropEdge)《DropEdge: Towards Deep Graph Convolutional Networks on Node Classification》
- LoRa Basics无线通信技术和应用案例详解
- C语言预处理命令是什么?
猜你喜欢
MySQL慢查询的多个原因
论文解读(DropEdge)《DropEdge: Towards Deep Graph Convolutional Networks on Node Classification》
[Graphic and textual] How to reinstall Win7 system
编程时请选择正确的输入法,严格区分中英文
Word箭头上面怎么打字
Pagoda measurement - building LightPicture open source map bed system
Lyapp exponents and bifurcation diagrams for fractional chaotic systems
Sudoku | Backtrack-7
APP automation test framework - UiAutomator2 introductory
LoRa无线技术在物联网应用市场的概况和发展
随机推荐
Interviewer: How to deal with Redis big key?
LoRa Basics无线通信技术和应用案例详解
fixed investment fund
Technology Sharing | How to Handle Header Cookies in Interface Automation Testing
QGIS编译SIP的问题
Tensorflow中使用convert_to_tensor去指定数据的类型
Optimization of SQL Statements and Indexes
MySQL慢查询的多个原因
DSPE-PEG-Silane, DSPE-PEG-SIL, phospholipid-polyethylene glycol-silane modified silica particles
Daily practice of PMP | Do not get lost in the exam -8.8 (including agility + multiple choice)
PMP每日一练 | 考试不迷路-8.9(包含敏捷+多选)
简单问题窥见数学
MySQL跨表、多表更新SQL语句总结
2021(ICPC)亚洲区域赛昆明站(CGHIJLM)
json事例
Ali Ermi: Without accept, can a TCP connection be established?
cadence中复制一部分PCB到另一个PCB中去
[Essay] To the friends of the 19th issue
Sudoku | Backtrack-7
定投的基金