mmdeploy/tests/test_csrc/net/test_trt_net.cpp
Li Zhang bf887cc8bc
[Enhancement] Refactor SDK pipeline (#938)
* unify C API naming

* fix demo and move apis/c/* -> apis/c/mmdeploy/*

* fix lint

* WIP refactor pipeline

* backward compatibility

* working pipeline demo

* add text det-recog demo

* add det-pose demo

* fix build

* fix demo

* add environment interface

* add environment to pass scheduler & model info at runtime

* update demos

* add pipeline API for Python

* fix `FromPyObject`

* fix for opencv-4.2

* environment -> context, improve pipeline

* python model interface

* fix cmake

* fix python & cmake

* context & C++ pipeline API

* minor fix

* improve API

* fix shared libs

* refresh C/Python API

* propagate context

* fix  python demo

* fix

* add namespace

* fix namespace

* fix mis-changed strings

* fix

* fix python api

* rename

* clean-up

* fix pose detector

* clean-up

* clean-up

* clean-up

* fix python API build

* fix CI

* fix lint

* fix lint

* fix lint & demo

* install pipeline.hpp

* fix MSVC shared library build

* fix sample

* fix MSVC monolithic build

* minor fix
2022-09-26 16:11:14 +08:00

33 lines
913 B
C++

// Copyright (c) OpenMMLab. All rights reserved.
// clang-format off
#include "catch.hpp"
// clang-format on
#include "mmdeploy/core/model.h"
#include "mmdeploy/core/net.h"
#include "test_resource.h"
using namespace mmdeploy;
using namespace framework;
TEST_CASE("test trt net", "[.trt_net][resource]") {
auto& gResource = MMDeployTestResources::Get();
auto model_list = gResource.LocateModelResources(fs::path{"mmcls"} / "trt");
REQUIRE(!model_list.empty());
Model model(model_list.front());
REQUIRE(model);
auto backend("tensorrt");
auto creator = Registry<Net>::Get().GetCreator(backend);
REQUIRE(creator);
Device device{"cuda"};
auto stream = Stream::GetDefault(device);
Value net_config{{"context", {{"device", device}, {"model", model}, {"stream", stream}}},
{"name", model.meta().models[0].name}};
auto net = creator->Create(net_config);
REQUIRE(net);
}