Commit d0c38c43 authored by Mircea Cimpoi's avatar Mircea Cimpoi Committed by Facebook GitHub Bot
Browse files

Add tests for exporter / boltnn export via torch delegate

Summary:
Adding test for previous diff.
Boltnn backend is supported on device -- so this test only checks if the conversion takes place and the output file is present.

Differential Revision: D29589245

fbshipit-source-id: ba66a733295304531d177086ce6459a50cfbaa07
parent ecf832da
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy import copy
import shutil import shutil
import tempfile import tempfile
...@@ -312,15 +310,19 @@ class RCNNBaseTestCases: ...@@ -312,15 +310,19 @@ class RCNNBaseTestCases:
) )
predictor = create_predictor(predictor_path) predictor = create_predictor(predictor_path)
predicotr_outputs = predictor(inputs) # This check is needed for models with unsupported backends.
_validate_outputs(inputs, predicotr_outputs) # For these, predictor.model_or_models will be None -- as the
# model can't be loaded or run. (e.g. BoltNN).
if predictor.model_or_models is not None:
predictor_outputs = predictor(inputs)
_validate_outputs(inputs, predictor_outputs)
if compare_match: if compare_match:
with torch.no_grad(): with torch.no_grad():
pytorch_outputs = self.test_model(inputs) pytorch_outputs = self.test_model(inputs)
assert_instances_allclose( assert_instances_allclose(
predicotr_outputs[0]["instances"], predictor_outputs[0]["instances"],
pytorch_outputs[0]["instances"], pytorch_outputs[0]["instances"],
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment