NVIDIA / TensorRT

NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT.
https://developer.nvidia.com/tensorrt
Apache License 2.0
10.74k stars 2.12k forks source link

How to build 3D tensor with c++ in Tensorrt #1283

Closed wangzhenlin123 closed 3 years ago

wangzhenlin123 commented 3 years ago

I try to inferent 3dcnn model with tensorrt,but i have no idea adout how to build 3d tensor in tensorrt with c++, could you provide some example to it?

ttyio commented 3 years ago

Hello @wangzhenlin123 , tensor support 8d tensor at most. The n-d tensor are the same, and are you asking for 3d conv? You can use addConvolutionNd to add it. Sorry there is no existing sample that I am aware.

wangzhenlin123 commented 3 years ago

Forgive me for my unclear explanation,for example:“cudaMemcpyAsync(buffers[inputIndex], input, batchSize INPUT_SIZE sizeof(float), cudaMemcpyHostToDevice, stream)” We can use OpenCV to read a 2D Mat graph and put it in the Buffer, but, In the case of 3D, is it possible to build the 3D Tensorr input by reading multiple 2D images in succession and then placing them in the Buffer one by one?3D is very important to me because I work with medical 3D images .

ttyio commented 3 years ago

Hello @wangzhenlin123 , yes it is the same, we can first check the input layout of your network, allocate GPU buffer has the same size, and finally use cudaMemcpyAsync to initialize the content of the GPU buffer. Did you hit any issue in doing so? thanks

wangzhenlin123 commented 3 years ago

I haven't tried yet,just Do some technical advice first。

ttyio commented 3 years ago

Thanks @wangzhenlin123 , closing, please reopen if you have more issues, thanks