Caffe2 - Python API
A deep learning, cross platform ML framework
Packages
Classes
Files
C++ API
Python API
GitHub
File List
caffe2
python
normalizer_context.py
1
# @package regularizer_context
2
# Module caffe2.python.normalizer_context
3
from
__future__
import
absolute_import
4
from
__future__
import
division
5
from
__future__
import
print_function
6
from
__future__
import
unicode_literals
7
8
from
caffe2.python
import
context
9
from
caffe2.python.modifier_context
import
(
10
ModifierContext, UseModifierBase)
11
12
13
@context.define_context(allow_default=
True
)
14
class
NormalizerContext
(ModifierContext):
15
"""
16
provide context to allow param_info to have different normalizers
17
"""
18
19
def
has_normalizer(self, name):
20
return
self._has_modifier(name)
21
22
def
get_normalizer(self, name):
23
assert
self.
has_normalizer
(name), (
24
"{} normalizer is not provided!"
.format(name))
25
return
self._get_modifier(name)
26
27
28
class
UseNormalizer
(UseModifierBase):
29
'''
30
context class to allow setting the current context.
31
Example useage with layer:
32
normalizers = {'norm1': norm1, 'norm2': norm2}
33
with UseNormalizer(normalizers):
34
norm = NormalizerContext.current().get_normalizer('norm1')
35
layer(norm=norm)
36
'''
37
def
_context_class(self):
38
return
NormalizerContext
caffe2.python.normalizer_context.NormalizerContext.has_normalizer
def has_normalizer(self, name)
Definition:
normalizer_context.py:19
caffe2.python
Definition:
__init__.py:1
caffe2.python.normalizer_context.UseNormalizer
Definition:
normalizer_context.py:28
caffe2.python.normalizer_context.NormalizerContext
Definition:
normalizer_context.py:14
caffe2.python.modifier_context
Definition:
modifier_context.py:1
Generated on Thu Mar 21 2019 13:06:36 for Caffe2 - Python API by
1.8.11