Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

neilisaac / torch   python

Repository URL to install this package:

/ python / normalizer_test.py





from caffe2.python.normalizer_context import UseNormalizer, NormalizerContext
from caffe2.python.normalizer import BatchNormalizer
from caffe2.python.layer_test_util import LayersTestCase


class TestNormalizerContext(LayersTestCase):
    def test_normalizer_context(self):
        bn = BatchNormalizer(momentum=0.1)
        with UseNormalizer({'BATCH': bn}):
            normalizer = NormalizerContext.current().get_normalizer('BATCH')
            self.assertEquals(bn, normalizer)