Converts a TRT datatype to its corresponding numpy dtype.
| 48 | |
| 49 | // Converts a TRT datatype to its corresponding numpy dtype. |
| 50 | py::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 | |
| 65 | nvinfer1::DataType type(py::dtype const& type) |
| 66 | { |
no outgoing calls
no test coverage detected