We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# [vae](https://github.com/bojone/vae)/vae_vmf_keras.py def sampling(mu): """vMF分布重参数操作 """ dims = K.int_shape(mu)[-1] # 预先计算一批w epsilon = 1e-7 x = np.arange(-1 + epsilon, 1, epsilon) y = kappa * x + np.log(1 - x**2) * (dims - 3) / 2 y = np.cumsum(np.exp(y - y.max())) y = y / y[-1] W = K.constant(np.interp(np.random.random(10**6), y, x)) # 实时采样w idx = K.random_uniform(K.shape(mu[:, :1]), 0, 10**6, dtype='int32') w = K.gather(W, idx) # 实时采样z eps = K.random_normal(K.shape(mu)) nu = eps - K.sum(eps * mu, axis=1, keepdims=True) * mu nu = K.l2_normalize(nu, axis=-1) return w * mu + (1 - w**2)**0.5 * nu
In numpy's docs (https://numpy.org/doc/stable/reference/generated/numpy.interp.html), numpy.interp(x, xp, fp, left=None, right=None, period=None)
numpy.interp(x, xp, fp, left=None, right=None, period=None)
While in the code there is np.interp(np.random.random(10**6), y, x), should it be np.interp(np.random.random(10**6), x, y)?
np.interp(np.random.random(10**6), y, x)
np.interp(np.random.random(10**6), x, y)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In numpy's docs (https://numpy.org/doc/stable/reference/generated/numpy.interp.html),
numpy.interp(x, xp, fp, left=None, right=None, period=None)
While in the code there is
np.interp(np.random.random(10**6), y, x)
,should it be
np.interp(np.random.random(10**6), x, y)
?The text was updated successfully, but these errors were encountered: