Skip to content
New issue

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

Add MultiNodeBatchNormalization #106

Merged
merged 20 commits into from
Aug 24, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add experimental flag
  • Loading branch information
iwiwi committed Aug 10, 2017
commit 71afd305c9ba1ed15693cf554f944b8307feff54
10 changes: 4 additions & 6 deletions chainermn/functions/batch_normalization.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import cffi
import chainer
import numpy
from chainer import configuration
from chainer import cuda
from chainer import function
import chainer.utils
from chainer.utils import type_check

import mpi4py.MPI

ffi = cffi.FFI()
import numpy


if cuda.cudnn_enabled:
Expand All @@ -34,6 +30,8 @@ def _xhat(x, mean, std, expander):
class MultiNodeBatchNormalizationFunction(function.Function):

def __init__(self, comm, eps=2e-5, mean=None, var=None, decay=0.9):
chainer.utils.experimental('chainermn.functions.MultiNodeBatchNormalizationFunction')

self.comm = comm
self.running_mean = mean
self.running_var = var
Expand Down
6 changes: 4 additions & 2 deletions chainermn/links/batch_normalization.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import numpy

import chainer.utils
from chainer import configuration
from chainer import cuda
from chainer import initializers
from chainer import link
from chainer import variable
from chainer.functions.normalization import batch_normalization
import numpy

from chainermn.functions.batch_normalization import \
MultiNodeBatchNormalizationFunction
Expand All @@ -16,6 +16,8 @@ class MultiNodeBatchNormalization(link.Link):
def __init__(self, size, comm, decay=0.9, eps=2e-5, dtype=numpy.float32,
use_gamma=True, use_beta=True,
initial_gamma=None, initial_beta=None):
chainer.utils.experimental('chainermn.links.MultiNodeBatchNormalization')

super(MultiNodeBatchNormalization, self).__init__()
self.comm = comm
self.avg_mean = numpy.zeros(size, dtype=dtype)
Expand Down