当前位置:网站首页>[tf1] save and load parameters
[tf1] save and load parameters
2022-07-05 07:09:00 【hanjialeOK】
tf.keras
Reference resources https://github.com/tensorflow/docs/blob/529ba4346b8fc5e830e762a2f0ee87b3c345c0c9/site/en/r1/guide/keras.ipynb
# Save weights to a TensorFlow Checkpoint file
model.save_weights('./weights/my_model')
# Restore the model's state,
# this requires a model with the same architecture.
model.load_weights('./weights/my_model')
It can also be saved as Keras HDF5 Format
# Save weights to a HDF5 file
model.save_weights('my_model.h5', save_format='h5')
# Restore the model's state
model.load_weights('my_model.h5')
Be careful ,h5 You may encounter this problem https://stackoverflow.com/questions/53740577/does-any-one-got-attributeerror-str-object-has-no-attribute-decode-whi
namely model.load_weights('my_model.h5')
When an error 'str' object has no attribute 'decode'
. terms of settlement :
pip freeze | grep h5py
pip install h5py==2.10.0
tf.train.Saver
You can save the specified parameters . Reference resources https://www.tensorflow.org/api_docs/python/tf/compat/v1/train/Saver
self._saver = tf.train.Saver(var_list=self._get_var_list(), \
max_to_keep=self.max_tf_checkpoints_to_keep)
self._saver.save(
self._sess,
os.path.join(checkpoint_dir, 'tf_ckpt'),
global_step=self.iteration)
self._saver.restore(self._sess,
os.path.join(checkpoint_dir,
'tf_ckpt-{}'.format(iteration_number)))
tf.train.Checkpoint
Don't understand, . Reference resources https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/train/Checkpoint
边栏推荐
- The difference between NPM install -g/-save/-save-dev
- Unity ugui how to match and transform coordinates between different UI panels or uis
- 扫盲-以太网MII接口类型大全-MII、RMII、SMII、GMII、RGMII、SGMII、XGMII、XAUI、RXAUI
- IPage能正常显示数据,但是total一直等于0
- 一文揭开,测试外包公司的真实情况
- npm install -g/--save/--save-dev的区别
- Unity 之 ExecuteAlways正在取代ExecuteInEditMode
- SD_CMD_SEND_SHIFT_REGISTER
- mingling
- Ros2 - first acquaintance with ros2 (I)
猜你喜欢
iNFTnews | 喝茶送虚拟股票?浅析奈雪的茶“发币”
1290_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
IPage能正常显示数据,但是total一直等于0
SD_CMD_RECEIVE_SHIFT_REGISTER
三体目标管理笔记
1290_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
Orin installs CUDA environment
Steps and FAQs of connecting windows Navicat to Alibaba cloud server MySQL
Inftnews | drink tea and send virtual stocks? Analysis of Naixue's tea "coin issuance"
U-boot initialization and workflow analysis
随机推荐
docker安装mysql并使用navicat连接
SRE核心体系了解
Unity 之 ExecuteAlways正在取代ExecuteInEditMode
[MySQL 8.0 does not support capitalization of table names - corresponding scheme]
1290_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
C#学习笔记
window navicat连接阿里云服务器mysql步骤及常见问题
【软件测试】06 -- 软件测试的基本流程
解读最早的草图-图像翻译工作SketchyGAN
Volcano 资源预留特性
ROS2——安装ROS2(三)
Concurrent programming - how to interrupt / stop a running thread?
Matlab在线性代数中的应用(四):相似矩阵及二次型
Spinningup drawing curve
Marvell 88E1515 PHY loopback模式测试
UTC, GPS time and Tai
CGroup CPU group source code analysis
Literacy Ethernet MII interface types Daquan MII, RMII, smii, gmii, rgmii, sgmii, XGMII, XAUI, rxaui
The difference between new and malloc
Technology blog learning website