当前位置:网站首页>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()
边栏推荐
猜你喜欢
Lyapp exponents and bifurcation diagrams for fractional chaotic systems
Bean生命周期
微软Excel表格点击单元格行和列都显示颜色怎么弄?聚光灯效果设置
DSPE-PEG-Azide, DSPE-PEG-N3, phospholipid-polyethylene glycol-azide can react directly with DBCO
Definition and Basic Operations of Sequence Tables
几种绘制时间线图的方法
编程时请选择正确的输入法,严格区分中英文
普源精电上半年扭亏为盈,高端产品持续发力!你看好仪器界“华为”吗?
fixed investment fund
Skywalking系列学习之Trace Profiling源码分析
随机推荐
蓝牙模块有哪些种类?BLE低功耗蓝牙模块有什么特点?
Don't use array.length-1 to get the last item of the array
DSPE-PEG-PDP, DSPE-PEG-OPSS, phospholipid-polyethylene glycol-mercaptopyridine reduce the immunogenicity of peptides
场效应管Mosfet之雷卯Leiditech对应英飞凌Infineon
DSPE-PEG-Azide, DSPE-PEG-N3, phospholipid-polyethylene glycol-azide can react directly with DBCO
Interpretation of the paper (DropEdge) "DropEdge: Towards Deep Graph Convolutional Networks on Node Classification"
Simulation of Water Temperature Control System Based on Fuzzy PID Controller
SecureCRT背景配色
Several ways to draw timeline diagrams
LeetCode26: remove duplicates in sorted array
什么是IDE(集成开发环境)?
Tensorflow模型整体构建流程
LED闪烁 闪灯芯片IC 手电筒IC 闪灯控制IC 闪烁IC流水灯
mysql多表左链接查询
蓝牙模块的分类和对应的属性特点
Hessian Matrix 海森矩阵
埃氏筛选法:统计素数个数
LeetCode Daily Question (321. Create Maximum Number)
AI识万物:从0搭建和部署手语识别系统
LoRa Basics无线通信技术和应用案例详解