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

Function toDims

samples/common/sampleUtils.cpp:62–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62nvinfer1::Dims toDims(std::vector<int32_t> const& vec)
63{
64 int32_t limit = static_cast<int32_t>(nvinfer1::Dims::MAX_DIMS);
65 if (static_cast<int32_t>(vec.size()) > limit)
66 {
67 sample::gLogWarning << "Vector too long, only first 8 elements are used in dimension." << std::endl;
68 }
69 // Pick first nvinfer1::Dims::MAX_DIMS elements
70 nvinfer1::Dims dims{std::min(static_cast<int32_t>(vec.size()), limit), {}};
71 std::copy_n(vec.begin(), dims.nbDims, std::begin(dims.d));
72 return dims;
73}
74
75void loadFromFile(std::string const& fileName, char* dst, size_t size)
76{

Callers 2

setupNetworkAndConfigFunction · 0.70
setUpInferenceFunction · 0.70

Calls 2

minFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected