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

Method _bootstrap_ops

caffe2/python/layers/fc_with_bootstrap.py:212–238  ·  view source on GitHub ↗

This method contains all the bootstrapping logic used to bootstrap the features. Only used by the train_net. Args: net: the caffe2 net to insert bootstrapping operators copied_cur_layer: the blob representing the current features

(self, net, copied_cur_layer, indices, iteration)

Source from the content-addressed store, hash-verified

210 return indices
211
212 def _bootstrap_ops(self, net, copied_cur_layer, indices, iteration):
213 """
214 This method contains all the bootstrapping logic used to bootstrap
215 the features. Only used by the train_net.
216
217 Args:
218 net: the caffe2 net to insert bootstrapping operators
219
220 copied_cur_layer: the blob representing the current features.
221 Note, this layer should have a stop_gradient on it.
222
223 Returns:
224 bootstrapped_features: blob of bootstrapped version of cur_layer
225 with same dimensions
226 """
227
228 # draw features based upon the bootstrapped indices
229 bootstrapped_features = net.Gather(
230 [copied_cur_layer, indices],
231 net.NextScopedBlob("bootstrapped_features_{}".format(iteration)),
232 )
233
234 bootstrapped_features = schema.Scalar(
235 (np.float32, self.input_dims), bootstrapped_features
236 )
237
238 return bootstrapped_features
239
240 def _insert_fc_ops(self, net, features, params, outputs, version):
241 """

Callers 1

add_train_opsMethod · 0.95

Calls 2

NextScopedBlobMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected