Caffe2 - Python API
A deep learning, cross platform ML framework
Packages
Classes
Files
C++ API
Python API
GitHub
File List
caffe2
python
modeling
parameter_info.py
1
from
__future__
import
absolute_import
2
from
__future__
import
division
3
from
__future__
import
print_function
4
from
__future__
import
unicode_literals
5
6
from
caffe2.python
import
core
7
8
import
numpy
as
np
9
10
11
class
ParameterTags
(object):
12
BIAS =
'BIAS'
13
WEIGHT =
'WEIGHT'
14
COMPUTED_PARAM =
'COMPUTED_PARAM'
15
16
17
class
ParameterInfo
(object):
18
19
def
__init__(
20
self, param_id, param, key=
None
, shape=
None
, length=
None
,
21
grad=
None
, blob_copy=
None
):
22
assert
isinstance(param,
core.BlobReference
)
23
self.
param_id
= param_id
24
self.
name
= str(param)
25
self.
blob
= param
26
self.
key
= key
27
self.
shape
= shape
28
self.
size
=
None
if
shape
is
None
else
np.prod(shape)
29
self.
length
= max(1, length
if
length
is
not
None
else
1)
30
self.
grad
= grad
31
self.
_cloned_init_net
=
None
32
# Optionally store equivalent copies of the blob
33
# in different precisions (i.e. half and float copies)
34
# stored as a dict of TensorProto.DataType -> BlobReference
35
self.
blob_copy
= blob_copy
36
# each param_info can have its own optimizer. It can be set within
37
# OptimizerContext (caffe2/python/optimizer.py)
38
self.
_optimizer
=
None
39
40
@property
41
def
parameter(self):
42
return
self.
blob
43
44
@property
45
def
optimizer(self):
46
return
self.
_optimizer
47
48
@optimizer.setter
49
def
optimizer(self, value):
50
assert
self.
_optimizer
is
None
,
"optimizer has already been set"
51
self.
_optimizer
= value
52
53
def
__str__(self):
54
return
self.
name
caffe2.python.modeling.parameter_info.ParameterInfo.key
key
Definition:
parameter_info.py:26
caffe2.python.modeling.parameter_info.ParameterInfo.name
name
Definition:
parameter_info.py:24
caffe2.python.modeling.parameter_info.ParameterInfo._optimizer
_optimizer
Definition:
parameter_info.py:38
caffe2.python.modeling.parameter_info.ParameterInfo
Definition:
parameter_info.py:17
caffe2.python.modeling.parameter_info.ParameterInfo.shape
shape
Definition:
parameter_info.py:27
caffe2.python
Definition:
__init__.py:1
caffe2.python.modeling.parameter_info.ParameterInfo.size
size
Definition:
parameter_info.py:28
caffe2.python.modeling.parameter_info.ParameterTags
Definition:
parameter_info.py:11
caffe2.python.modeling.parameter_info.ParameterInfo.length
length
Definition:
parameter_info.py:29
caffe2.python.modeling.parameter_info.ParameterInfo.blob_copy
blob_copy
Definition:
parameter_info.py:35
caffe2.python.core.BlobReference
Definition:
core.py:179
caffe2.python.modeling.parameter_info.ParameterInfo.blob
blob
Definition:
parameter_info.py:25
caffe2.python.modeling.parameter_info.ParameterInfo._cloned_init_net
_cloned_init_net
Definition:
parameter_info.py:31
caffe2.python.modeling.parameter_info.ParameterInfo.grad
grad
Definition:
parameter_info.py:30
caffe2.python.modeling.parameter_info.ParameterInfo.param_id
param_id
Definition:
parameter_info.py:23
Generated on Thu Mar 21 2019 13:06:36 for Caffe2 - Python API by
1.8.11