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

Method testFCWithBootstrap

caffe2/python/layers_test.py:246–323  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

244 self.assertNetContainOps(predict_net, [mat_mul_spec])
245
246 def testFCWithBootstrap(self):
247 output_dims = 1
248 fc_with_bootstrap = self.model.FCWithBootstrap(
249 self.model.input_feature_schema.float_features,
250 output_dims=output_dims,
251 num_bootstrap=2,
252 max_fc_size=-1
253 )
254 self.model.output_schema = fc_with_bootstrap
255
256
257 self.assertEqual(len(fc_with_bootstrap), 4)
258
259 # must be in this order
260 assert (
261 core.BlobReference("fc_with_bootstrap/bootstrap_iteration_0/indices") == fc_with_bootstrap[0].field_blobs()[0]
262 )
263 assert (
264 core.BlobReference("fc_with_bootstrap/bootstrap_iteration_0/preds") == fc_with_bootstrap[1].field_blobs()[0]
265 )
266 assert (
267 core.BlobReference("fc_with_bootstrap/bootstrap_iteration_1/indices") == fc_with_bootstrap[2].field_blobs()[0]
268 )
269 assert (
270 core.BlobReference("fc_with_bootstrap/bootstrap_iteration_1/preds") == fc_with_bootstrap[3].field_blobs()[0]
271 )
272
273 train_init_net, train_net = self.get_training_nets()
274 predict_net = layer_model_instantiator.generate_predict_net(self.model)
275
276 train_proto = train_net.Proto()
277 eval_proto = predict_net.Proto()
278
279 train_ops = train_proto.op
280 eval_ops = eval_proto.op
281
282 master_train_ops = [
283 "Shape",
284 "GivenTensorInt64Fill",
285 "Gather",
286 "GivenTensorIntFill",
287 "GivenTensorIntFill",
288 "Cast",
289 "Sub",
290 "UniformIntFill",
291 "Gather",
292 "FC",
293 "UniformIntFill",
294 "Gather",
295 "FC",
296 ]
297
298 master_eval_ops = [
299 "Shape",
300 "GivenTensorInt64Fill",
301 "Gather",
302 "GivenTensorIntFill",
303 "GivenTensorIntFill",

Callers

nothing calls this directly

Calls 5

listFunction · 0.85
get_training_netsMethod · 0.80
assertEqualMethod · 0.45
field_blobsMethod · 0.45
ProtoMethod · 0.45

Tested by

no test coverage detected