codecamp

如何使用ConditionalAccumulatorBase

tf.ConditionalAccumulatorBase

tf.ConditionalAccumulatorBase 类

定义在:tensorflow/python/ops/data_flow_ops.py

参见指南:输入和读取器>条件累加器

用于聚合梯度的条件累加器.

最新的梯度(即计算梯度的时间步长等于累加器的时间步长)加到累加器中.

平均梯度的提取被阻塞,直到所需数量的渐变被累积为止.

属性:

  • accumulator_ref
    底层累加器引用.
  • dtype
    该累加器积累的梯度的数据类型.
  • name
    底层累加器的名称.

方法

__init__

__init__ (
dtype ,
shape ,
accumulator_ref
)

创建一个新的 ConditionalAccumulator.

ARGS:

  • dtype:累积梯度的数据类型.
  • shape:累积梯度的形状.
  • accumulator_ref:由子类创建的条件累加器的句柄

num_accumulated

num_accumulated ( name = None )

目前在累加器中聚合的梯度数.

ARGS:

  • name:操作的可选名称.

返回:

当前积累的累积梯度数.

set_global_step

set_global_step (
new_global_step ,
name = None
)

设置累加器的全局时间步长.

如果我们尝试设置的时间步长低于累加器自己的时间步长,则操作会记录一个警告.

ARGS:

  • new_global_step:新的时间步长的值.可以是变量或常数.
  • name:操作的可选名称.

返回:

设置累加器的时间步长的操作.

TensorFlow聚合梯度的条件累加器
TensorFlow如何计算混淆矩阵
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }