Closed azad96 closed 3 years ago
After some debugging, I've found out that "mBatch" in the following function in gridSamplerPlugin.cpp is not set yet. Therefore, its value is 0, which results in the problem I stated above.
int GridSamplerPlugin::enqueue(int batchSize, const void*const * inputs, void** outputs, void* workspace, cudaStream_t stream)
{
int status = -1;
GridSamplerDataType dataType = (mType == DataType::kFLOAT ? GridSamplerDataType::GFLOAT : GridSamplerDataType::GHALF);
status = grid_sampler_2d_cuda(mBatch, inputs[0], inputs[1], outputs[0],
mInputChannel, mInputHeight, mInputWidth, mGridHeight, mGridWidth,
mInputChannel*mInputHeight*mInputWidth, mInputHeight*mInputWidth, mInputWidth, 1,
mGridHeight*mGridWidth*2, mGridWidth*2, 2, 1,
mInputChannel*mGridHeight*mGridWidth, mGridHeight*mGridWidth, mGridWidth, 1,
mInterpolationMode, mPaddingMode, mAlignCorners, dataType, stream);
return status;
}
Using enqueue's parameter batchSize instead of mBatch fixed the problem for me. I guess serializing mBatch member like others (mInputChannel, mInputHeight, etc.) will be another solution but mine seems easier.
Hi, I've added the all the 5 grid sample files to my example project written in TensorRT C++ API. Then, I feed an input and grid that I initialized in my main.cpp to the plugin layer in order to see how it works as follows:
The code works but all the values of output are 0. I feed the same input and grid in python, so I know it should not be 0. I am using TensorRT 6.0 and CUDA 10.1. Any idea what I am doing wrong?