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

Function nptype

python/src/utils.cpp:50–63  ·  view source on GitHub ↗

Converts a TRT datatype to its corresponding numpy dtype.

Source from the content-addressed store, hash-verified

48
49// Converts a TRT datatype to its corresponding numpy dtype.
50py::dtype nptype(nvinfer1::DataType type)
51{
52 switch (type)
53 {
54 case nvinfer1::DataType::kFLOAT: return py::dtype("f4");
55 case nvinfer1::DataType::kHALF: return py::dtype("f2");
56 case nvinfer1::DataType::kINT8: return py::dtype("i1");
57 case nvinfer1::DataType::kINT32: return py::dtype("i4");
58 case nvinfer1::DataType::kBOOL: return py::dtype("b1");
59 case nvinfer1::DataType::kUINT8: return py::dtype("u1");
60 case nvinfer1::DataType::kFP8: return py::dtype("f1");
61 }
62 return py::dtype("unknown");
63}
64
65nvinfer1::DataType type(py::dtype const& type)
66{

Callers 2

pyCaffe.cppFile · 0.50
utils.hFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected