예제 #1
0
	def grad(self, w, z):
		if self.n_minibatches==1: return self.subgrad(0, w, z)
		logpxi, logpzi, gwi, _ = tuple(zip(*[self.subgrad(i, w, z) for i in range(self.n_minibatches)]))
		return np.hstack(logpxi), np.hstack(logpzi), ndict.sum(gwi)
예제 #2
0
	def grad(self, w):
		logpxi, gwi = tuple(zip(*[self.subgrad(i, w) for i in range(self.n_minibatches)]))
		return np.hstack(logpxi), ndict.sum(gwi)