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
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import shutil
import tempfile
......@@ -312,17 +310,21 @@ class RCNNBaseTestCases:
)
predictor = create_predictor(predictor_path)
predicotr_outputs = predictor(inputs)
_validate_outputs(inputs, predicotr_outputs)
if compare_match:
with torch.no_grad():
pytorch_outputs = self.test_model(inputs)
assert_instances_allclose(
predicotr_outputs[0]["instances"],
pytorch_outputs[0]["instances"],
)
# This check is needed for models with unsupported backends.
# 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:
with torch.no_grad():
pytorch_outputs = self.test_model(inputs)
assert_instances_allclose(
predictor_outputs[0]["instances"],
pytorch_outputs[0]["instances"],
)
return predictor_path
......
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