def _apply_sparse(self, cache):
""""""
g_t, idxs = cache['g_t'], cache['idxs']
idxs, idxs_ = tf.unique(idxs)
g_t_ = tf.unsorted_segment_sum(g_t, idxs_, tf.size(idxs))
cache['g_t'] = g_t_
cache['idxs'] = idxs
cache['s_t'] = self.learning_rate * g_t_
return cache
评论列表
文章目录