MCPcopy Index your code
hub / github.com/pytorch/pytorch / Initializer

Class Initializer

caffe2/python/modeling/initializers.py:10–33  ·  view source on GitHub ↗

This class abstracts out parameter creation. One can come up with a new Initializer in order to implement more complex parameter initialization logic

Source from the content-addressed store, hash-verified

8
9
10class Initializer:
11 '''
12 This class abstracts out parameter creation. One can come up with a new
13 Initializer in order to implement more complex parameter initialization logic
14 '''
15
16 def __init__(self, operator_name=None, **kwargs):
17 self.operator_name = operator_name
18 self.operator_kwargs = kwargs
19
20 def update(self, operator_name, kwargs):
21 if self.operator_name is not None:
22 raise Exception("Operator name overwrites are not allowed")
23 self.operator_name = operator_name
24 self.operator_kwargs = kwargs
25
26 def create_param(self, param_name, init_net, shape):
27 param = init_net.__getattr__(self.operator_name)(
28 [], param_name, shape=shape, **self.operator_kwargs)
29 return ParameterInfo(
30 param_id=None,
31 param=param,
32 shape=shape,
33 )
34
35
36class ExternalInitializer:

Callers 7

create_statesMethod · 0.90
_applyMethod · 0.90
_applyMethod · 0.90
cudnn_LSTMFunction · 0.90
test_create_paramMethod · 0.90
test_deep_hierarchyMethod · 0.90
update_initializerFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_create_paramMethod · 0.72
test_deep_hierarchyMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…