MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / getBatch

Function getBatch

python/src/infer/pyInt8.cpp:52–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 }
51
52 bool getBatch(void* bindings[], const char* names[], int nbBindings) noexcept override
53 {
54 try
55 {
56 py::gil_scoped_acquire gil{};
57
58 py::function pyGetBatch = utils::getOverride(static_cast<Derived*>(this), "get_batch");
59 std::vector<const char*> namesVec(names, names + nbBindings);
60 py::object result = pyGetBatch(namesVec);
61 // Copy over into the other data structure.
62 if (!result.is_none() && result.cast<std::vector<size_t>>().size() != 0)
63 {
64 std::memcpy(bindings, result.cast<std::vector<size_t>>().data(), nbBindings * sizeof(void*));
65 return true;
66 }
67 }
68 catch (std::exception const& e)
69 {
70 std::cerr << "[ERROR] Exception caught in get_batch(): " << e.what() << std::endl;
71 }
72 catch (...)
73 {
74 std::cerr << "[ERROR] Exception caught in get_batch()" << std::endl;
75 }
76 return false;
77 }
78
79 const void* readCalibrationCache(std::size_t& length) noexcept override
80 {

Callers 1

nextMethod · 0.85

Calls 3

getOverrideFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected