tf.train.Saver.save

简介:
save(self, sess, save_path, global_step=None, latest_filename=None, meta_graph_suffix='meta', write_meta_graph=True, write_state=True)
    Saves variables.
    
    This method runs the ops added by the constructor for saving variables.
    It requires a session in which the graph was launched.  The variables to
    save must also have been initialized.
    
    The method returns the path prefix of the newly created checkpoint files.
    This string can be passed directly to a call to `restore()`.
    
    Args:
      sess: A Session to use to save the variables.
      save_path: String.  Prefix of filenames created for the checkpoint.
      global_step: If provided the global step number is appended to
        `save_path` to create the checkpoint filenames. The optional argument
        can be a `Tensor`, a `Tensor` name or an integer.
      latest_filename: Optional name for the protocol buffer file that will
        contains the list of most recent checkpoints.  That file,
        kept in the same directory as the checkpoint files, is automatically
        managed by the saver to keep track of recent checkpoints.  Defaults to
        'checkpoint'.
      meta_graph_suffix: Suffix for `MetaGraphDef` file. Defaults to 'meta'.
      write_meta_graph: `Boolean` indicating whether or not to write the meta
        graph file.
      write_state: `Boolean` indicating whether or not to write the
        `CheckpointStateProto`.
    
    Returns:
      A string: path prefix used for the checkpoint files.  If the saver is
        sharded, this string ends with: '-?????-of-nnnnn' where 'nnnnn'
        is the number of shards created.
      If the saver is empty, returns None.
    
    Raises:
      TypeError: If `sess` is not a `Session`.
      ValueError: If `latest_filename` contains path components, or if it
        collides with `save_path`.
      RuntimeError: If save and restore ops weren't built.

目录
相关文章
|
2月前
tf.zeros(), tf.zeros_like(), tf.ones(),tf.ones_like()
【8月更文挑战第11天】tf.zeros(), tf.zeros_like(), tf.ones(),tf.ones_like()。
29 5
|
2月前
|
机器学习/深度学习 TensorFlow 算法框架/工具
【Tensorflow+keras】解决cuDNN launch failure : input shape ([32,2,8,8]) [[{{node sequential_1/batch_nor
在使用TensorFlow 2.0和Keras训练生成对抗网络(GAN)时,遇到了“cuDNN launch failure”错误,特别是在调用self.generator.predict方法时出现,输入形状为([32,2,8,8])。此问题可能源于输入数据形状与模型期望的形状不匹配或cuDNN版本不兼容。解决方案包括设置GPU内存增长、检查模型定义和输入数据形状、以及确保TensorFlow和cuDNN版本兼容。
31 1
|
存储 测试技术
测试模型时,为什么要with torch.no_grad(),为什么要model.eval(),如何使用with torch.no_grad(),model.eval(),同时使用还是只用其中之一
在测试模型时,我们通常使用with torch.no_grad()和model.eval()这两个方法来确保模型在评估过程中的正确性和效率。
856 0
|
PyTorch 算法框架/工具 索引
详细介绍torch中的from torch.utils.data.sampler相关知识
PyTorch中的torch.utils.data.sampler模块提供了一些用于数据采样的类和函数,这些类和函数可以用于控制如何从数据集中选择样本。下面是一些常用的Sampler类和函数的介绍: Sampler基类: Sampler是一个抽象类,它定义了一个__iter__方法,返回一个迭代器,用于生成数据集中的样本索引。 RandomSampler: 随机采样器,它会随机从数据集中选择样本。可以设置随机数种子,以确保每次采样结果相同。 SequentialSampler: 顺序采样器,它会按照数据集中的顺序,依次选择样本。 SubsetRandomSampler: 子集随机采样器
594 0
|
机器学习/深度学习 并行计算 PyTorch
Pytorch 的 torch.utils.data.DataLoader 参数详解
Pytorch 的 torch.utils.data.DataLoader 参数详解
1020 0
from sklearn.cross_validation import train_test_split发生报错
from sklearn.cross_validation import train_test_split发生报错
256 0
from sklearn.cross_validation import train_test_split发生报错
成功解决ValueError: Cannot feed value of shape (1, 10, 4) for Tensor Placeholder:0 , which has shape
成功解决ValueError: Cannot feed value of shape (1, 10, 4) for Tensor Placeholder:0 , which has shape
|
定位技术 内存技术
TF 卡是什么
TF 卡是什么
453 0
|
移动开发
同样是保存模型,model.save()和model. save_weights ()有何区别
同样是保存模型,model.save()和model. save_weights ()有何区别
606 0