tf.reset_default_graph()

简介:

tf.reset_default_graph函数用于清除默认图形堆栈并重置全局默认图形。 

注意:默认图形是当前线程的一个属性。该tf.reset_default_graph函数只适用于当前线程。当一个tf.Session或者tf.InteractiveSession激活时调用这个函数会导致未定义的行为。调用此函数后使用任何以前创建的tf.Operation或tf.Tensor对象将导致未定义的行为。

可能引发的异常:

  • AssertionError:如果在嵌套图中调用此函数则会引发此异常。

Clears the default graph stack and resets the global default graph.

    

    NOTE: The default graph is a property of the current thread. This

    function applies only to the current thread.  Calling this function while

    a `tf.Session` or `tf.InteractiveSession` is active will result in undefined

    behavior. Using any previously created `tf.Operation` or `tf.Tensor` objects

    after calling this function will result in undefined behavior.

    Raises:

      AssertionError: If this function is called within a nested graph.

目录
相关文章
|
5月前
|
Docker 容器
求助: 运行模型时报错module 'megatron_util.mpu' has no attribute 'get_model_parallel_rank'
运行ZhipuAI/Multilingual-GLM-Summarization-zh的官方代码范例时,报错AttributeError: MGLMTextSummarizationPipeline: module 'megatron_util.mpu' has no attribute 'get_model_parallel_rank' 环境是基于ModelScope官方docker镜像,尝试了各个版本结果都是一样的。
283 5
|
2月前
random.sample(population, k)
random.sample(population, k)
16 0
|
3月前
|
机器学习/深度学习 人工智能
【CatBoost报错解决】CatBoostError: Bad value for num feature[non default doc idx=0,feature idx=19]=
【CatBoost报错解决】CatBoostError: Bad value for num feature[non default doc idx=0,feature idx=19]=
|
API 数据格式
TensorFlow2._:model.summary() Output Shape为multiple解决方法
TensorFlow2._:model.summary() Output Shape为multiple解决方法
183 0
TensorFlow2._:model.summary() Output Shape为multiple解决方法
|
8月前
Can‘t get attribute ‘SiLU‘ on <module ‘torch.nn.modules.activation‘
Can‘t get attribute ‘SiLU‘ on <module ‘torch.nn.modules.activation‘
|
JSON 数据格式
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
419 0
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
|
算法框架/工具 Windows
|
XML 数据格式
Adobe form batch output print mode - multiple
Customer wants to render the body page 4 times on 4 different master page in one PDF. Take “Invoice” as example, the first copy will be printed on master page with text “for Customer”, the second copy will be printed on master page with text “for archive”.
103 0
|
并行计算
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the
441 0