MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / test_flop

Method test_flop

tests/test_model_analysis.py:45–53  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

43 self.model = get_model_zoo("COCO-Detection/faster_rcnn_R_50_FPN_1x.yaml")
44
45 def test_flop(self):
46 # Faster R-CNN supports flop-counting with random inputs
47 inputs = [{"image": torch.rand(3, 800, 800)}]
48 res = flop_count_operators(self.model, inputs)
49
50 # This only checks flops for backbone & proposal generator
51 # Flops for box head is not conv, and depends on #proposals, which is
52 # almost 0 for random inputs.
53 self.assertTrue(int(res["conv"]), 117)
54
55 def test_param_count(self):
56 res = parameter_count(self.model)

Callers

nothing calls this directly

Calls 1

flop_count_operatorsFunction · 0.90

Tested by

no test coverage detected