Example #1
0
    def test_multiple_runners(self):
        load_tf = TF_MODELS["identity"].loader
        build_tf_session = SessionFromGraph(load_tf)
        load_serialized_onnx = BytesFromOnnx(OnnxFromTfGraph(load_tf))
        build_onnxrt_session = SessionFromOnnxBytes(load_serialized_onnx)
        load_engine = EngineFromNetwork(NetworkFromOnnxBytes(load_serialized_onnx))

        runners = [
            TfRunner(build_tf_session),
            OnnxrtRunner(build_onnxrt_session),
            TrtRunner(load_engine),
        ]

        run_results = Comparator.run(runners)
        compare_func = CompareFunc.basic_compare_func(check_shapes=version(trt.__version__) >= version("7.0"))
        assert bool(Comparator.compare_accuracy(run_results, compare_func=compare_func))
        assert len(list(run_results.values())[0]) == 1 # Default number of iterations
Example #2
0
 def test_opset(self):
     loader = OnnxFromTfGraph(TF_MODELS["identity"].loader, opset=9)
     model = loader()
     assert model.opset_import[0].version == 9
Example #3
0
 def test_no_optimize(self):
     loader = OnnxFromTfGraph(TF_MODELS["identity"].loader,
                              optimize=False,
                              fold_constant=False)
     model = loader()