IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

weights.py 513B

12345678910111213141516171819
  1. #
  2. # Copyright (C) Stanislaw Adaszewski, 2020
  3. # License: GPLv3
  4. #
  5. import torch
  6. import numpy as np
  7. def init_glorot(in_channels, out_channels, dtype=torch.float32):
  8. """Create a weight variable with Glorot & Bengio (AISTATS 2010)
  9. initialization.
  10. """
  11. init_range = np.sqrt(6.0 / (in_channels + out_channels))
  12. initial = -init_range + 2 * init_range * \
  13. torch.rand(( in_channels, out_channels ), dtype=dtype)
  14. initial = initial.requires_grad_(True)
  15. return initial