示例#1
0
 def test_basic(self, replay):
     context, _, algo, replay_data, _ = replay
     replayer = TacticReplayer(replay_data)
     selected = replayer.select_algorithms(
         context, [fake_algo(implementation=2), algo,
                   fake_algo(tactic=1)])
     assert selected == [1]
示例#2
0
 def test_missing_algo_fails(self, replay):
     context, _, _, replay_data, _ = replay
     replayer = TacticReplayer(replay_data)
     with pytest.raises(PolygraphyException,
                        match="was not provided by TensorRT as a choice"):
         assert replayer.select_algorithms(context,
                                           [fake_algo(2, 1)]) == [0]
 def test_new_layer_falls_back(self, replay):
     _, _, _, replay_data, _ = replay
     replayer = TacticReplayer(replay_data)
     selected = replayer.select_algorithms(
         fake_context(name="new_layer"), [fake_algo(2, 1), fake_algo(3, 4), fake_algo(5, 6)]
     )
     assert selected == [0, 1, 2]
示例#4
0
 def test_fails_if_wrong_selected(self, replay):
     context, _, _, replay_data, _ = replay
     replayer = TacticReplayer(replay_data)
     # We should be able to check tactics even if we're not recording them.
     with pytest.raises(PolygraphyException,
                        match="TensorRT selected a tactic different"):
         replayer.report_algorithms([context],
                                    [fake_algo(implementation=9)])