MCPcopy Create free account
hub / github.com/pytorch/pytorch / __init__

Method __init__

caffe2/python/modeling/parameter_info.py:19–38  ·  view source on GitHub ↗
(
            self, param_id, param, key=None, shape=None, length=None,
            grad=None, blob_copy=None)

Source from the content-addressed store, hash-verified

17class ParameterInfo:
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):

Callers

nothing calls this directly

Calls 3

isinstanceFunction · 0.85
maxFunction · 0.50
prodMethod · 0.45

Tested by

no test coverage detected