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

Method add_param_DEPRECATED

caffe2/python/model_helper.py:241–258  ·  view source on GitHub ↗
(self, param, key=None, shape=None, length=None)

Source from the content-addressed store, hash-verified

239 # This method is deprecated, use create_param method which
240 # also does parameter initialization when needed
241 def add_param_DEPRECATED(self, param, key=None, shape=None, length=None):
242 logging.warning("add_param method is DEPRECATED")
243 self._update_param_info_deprecated()
244 self.AddParameter(param)
245 if key is not None and self.net.input_record() is not None:
246 idx = self.net.input_record().field_blobs().index(key)
247 key = self.net.input_record().field_names()[idx]
248 shape = shape if shape is not None else self._infer_param_shape(param)
249 if not isinstance(param, core.BlobReference):
250 raise ValueError("Param %s must be a BlobReference!" % str(param))
251 self._param_info_deprecated.append(parameter_info.ParameterInfo(
252 param_id=len(self._param_info_deprecated),
253 param=param,
254 shape=shape,
255 key=key,
256 length=length,
257 ))
258 return self._param_info_deprecated[-1]
259
260 def AddParameter(self, param, tags=None):
261 assert isinstance(param, core.BlobReference)

Callers

nothing calls this directly

Calls 10

AddParameterMethod · 0.95
_infer_param_shapeMethod · 0.95
isinstanceFunction · 0.85
warningMethod · 0.80
input_recordMethod · 0.45
indexMethod · 0.45
field_blobsMethod · 0.45
field_namesMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected