0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gaussian_kl_divergenceメモ

Posted at

chainer.functions.loss.vae.gaussian_kl_divergenceの使い方メモ
引数に多変量正規分布の平均ベクトルと対数共分散行列をとり, 出力結果として
引数のパラメータをもつ多変量正規分布と多変量標準正規分布とのKL-divergenceの値を
返してくれる.

VAEのコードを書く際に, 潜在分布と標準正規分布のKL-divergenceを最小化する
条件を書くと思うのでこいつを用いるとサラッとかけたりする.
下記の通り, 引数として用いる分散は対数を取ったものであることに注意.

from chainer.functions.loss.vae import gaussian_kl_divergence

mu = np.array([0.0, 0.0])
ln_var = np.array([[0.0, 0.0], [0.0, 0.0]])

gaussian_kl_divergence(mu, ln_var)
variable(0.)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?