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

Method add_ops

caffe2/python/layers/fc_with_bootstrap.py:290–321  ·  view source on GitHub ↗

Both the predict net and the eval net will call this function. For bootstrapping approach, the goal is to pass the cur_layer feature inputs through all the bootstrapped FCs that are stored under self.bootstrapped_FCs. Return the preds in the same out

(self, net)

Source from the content-addressed store, hash-verified

288 )
289
290 def add_ops(self, net):
291 """
292 Both the predict net and the eval net will call this function.
293
294 For bootstrapping approach, the goal is to pass the cur_layer feature
295 inputs through all the bootstrapped FCs that are stored under
296 self.bootstrapped_FCs. Return the preds in the same output_schema
297 with dummy indices (because they are not needed).
298 """
299
300 version_info = get_current_scope().get(
301 get_fc_predictor_version.__name__, {"fc_version": "fp32"}
302 )
303 predictor_fc_fp_version = version_info["fc_version"]
304
305 for i in range(self.num_bootstrap):
306 # these are dummy indices, not to be used anywhere
307 indices = self._generate_bootstrapped_indices(
308 net=net,
309 copied_cur_layer=self.input_record.field_blobs()[0],
310 iteration=i,
311 )
312
313 params = self.bootstrapped_FCs[i * 2 : (i * 2) + 2]
314
315 self._add_ops(
316 net=net,
317 features=self.input_record,
318 params=params,
319 iteration=i,
320 version=predictor_fc_fp_version,
321 )
322
323 def add_train_ops(self, net):
324 # use the train_param_blobs to be consistent with the SamplingTrain unittest

Callers

nothing calls this directly

Calls 6

_add_opsMethod · 0.95
get_current_scopeFunction · 0.90
rangeFunction · 0.50
getMethod · 0.45
field_blobsMethod · 0.45

Tested by

no test coverage detected