| 1703 | } |
| 1704 | |
| 1705 | bool checkSafeEngine(void const* serializedEngine, int32_t const engineSize) |
| 1706 | { |
| 1707 | if (!hasConsistencyChecker()) |
| 1708 | { |
| 1709 | sample::gLogError << "Cannot perform consistency check because the checker is not loaded.." << std::endl; |
| 1710 | return false; |
| 1711 | } |
| 1712 | auto checker = std::unique_ptr<nvinfer1::consistency::IConsistencyChecker>( |
| 1713 | createConsistencyChecker(sample::gLogger.getTRTLogger(), serializedEngine, engineSize)); |
| 1714 | if (checker.get() == nullptr) |
| 1715 | { |
| 1716 | sample::gLogError << "Failed to create consistency checker." << std::endl; |
| 1717 | return false; |
| 1718 | } |
| 1719 | sample::gLogInfo << "Start consistency checking." << std::endl; |
| 1720 | if (!checker->validate()) |
| 1721 | { |
| 1722 | sample::gLogError << "Consistency validation failed." << std::endl; |
| 1723 | return false; |
| 1724 | } |
| 1725 | sample::gLogInfo << "Consistency validation passed." << std::endl; |
| 1726 | return true; |
| 1727 | } |
| 1728 | } // namespace sample |
no test coverage detected