Advertisement

tensorflow模型的保存和加载

阅读量:

tensorflow 模型的保存与加载

代码

复制代码
    # -*- coding: utf-8 -*-
    """
    Created on  2020/11/20 9:41
    @Author: CY
    @email: 5844104706@qq.com
    """
    
    # pip install -q pyyaml h5py  # 以 HDF5 格式保存模型所必须
    import os
    
    import tensorflow as tf
    from tensorflow import keras
    
    print(tf.version.VERSION)
    
    print("# 1 数据集")
    (train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.mnist.load_data()
    train_labels = train_labels[:1000]
    test_labels = test_labels[:1000]
    train_images = train_images[:1000].reshape(-1, 28 * 28) / 2

全部评论 (0)

还没有任何评论哟~