chore: import upstream snapshot with attribution
Docker Image CI / build-ubuntu2004 (push) Has been cancelled
Docker Image CI / build-ubuntu2004 (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
add_plugin_source(
|
||||
multilevelCropAndResizePlugin.cpp
|
||||
multilevelCropAndResizePlugin.h
|
||||
)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
---
|
||||
name: MultilevelCropAndResize_TRT
|
||||
interface: "IPluginV2Ext"
|
||||
versions:
|
||||
"1":
|
||||
attributes:
|
||||
- pooled_size
|
||||
- image_size
|
||||
attribute_types:
|
||||
pooled_size: int32
|
||||
image_size: int32
|
||||
attribute_length:
|
||||
pooled_size: 1
|
||||
image_size: 3
|
||||
attribute_options:
|
||||
pooled_size:
|
||||
min: "0"
|
||||
max: "=pinf"
|
||||
image_size:
|
||||
min: "0, 0, 0"
|
||||
max: "=pinf, =pinf, =pinf"
|
||||
attributes_required:
|
||||
- pooled_size
|
||||
...
|
||||
@@ -0,0 +1,60 @@
|
||||
# MultilevelCropAndResize [DEPRECATED]
|
||||
|
||||
**This plugin is deprecated since TensorRT 10.12 and will be removed in a future release. Note alternatives are planned to be provided.**
|
||||
|
||||
**Table Of Contents**
|
||||
- [Description](#description)
|
||||
* [Structure](#structure)
|
||||
- [Parameters](#parameters)
|
||||
- [Additional resources](#additional-resources)
|
||||
- [License](#license)
|
||||
- [Changelog](#changelog)
|
||||
- [Known issues](#known-issues)
|
||||
|
||||
## Description
|
||||
|
||||
The `MultilevelCropAndResize` plugin performs the ROIAlign operation on the output feature maps from FPN (Feature Pyramid Network). It is used for MaskRCNN inference in Transfer Learning Toolkit.
|
||||
|
||||
|
||||
### Structure
|
||||
|
||||
This plugin supports the NCHW format. It takes 6 inputs in the following order: `roi`, and 5 `feature_maps` from FPN (Note: 5 `feature_maps` are required for this plugin and will not function properly with a lesser number of `feature_maps`).
|
||||
|
||||
`roi` is the ROI candidates from the `MultilevelProposeROI` plugin. Its shape is `[N, rois, 4]` where `N` is the batch_size, `rois` is the number of ROI candidates and `4` is the number of coordinates.
|
||||
|
||||
`feature_maps` are the output of FPN. In TLT MaskRCNN, the model we provide contains 5 feature maps from FPN's different stages.
|
||||
|
||||
This plugin generates one output tensor of shape `[N, rois, C, pooled_size, pooled_size]` where `C` is the channel of mutiple feature maps from FPN and `pooled_size` is the height(and width) of the feature area after ROIAlign.
|
||||
|
||||
## Parameters
|
||||
|
||||
This plugin has the plugin creator class `MultilevelCropAndResizePluginCreator` and the plugin class `MultilevelCropAndResize`.
|
||||
|
||||
The following parameters were used to create `MultilevelCropAndResize` instance:
|
||||
|
||||
| Type | Parameter | Description
|
||||
|------------------|---------------------------------|--------------------------------------------------------
|
||||
|`int` |`pooled_size` | The spatial size of a feature area after ROIAlgin will be `[pooled_size, pooled_size]`
|
||||
|`int[3]` |`image_size` | The size of the input image in CHW. Defaults to [3, 832, 1344]
|
||||
|
||||
## Additional resources
|
||||
|
||||
|
||||
## License
|
||||
|
||||
For terms and conditions for use, reproduction, and distribution, see the [TensorRT Software License Agreement](https://docs.nvidia.com/deeplearning/sdk/tensorrt-sla/index.html)
|
||||
documentation.
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
May 2025: Add deprecation note.
|
||||
|
||||
March 2022: This is the second release of this `README.md` file.
|
||||
|
||||
June 2020: First release of this `README.md` file.
|
||||
|
||||
|
||||
## Known issues
|
||||
|
||||
There are no known issues in this plugin.
|
||||
@@ -0,0 +1,337 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "multilevelCropAndResizePlugin.h"
|
||||
#include "common/plugin.h"
|
||||
#include <algorithm>
|
||||
#include <cuda_runtime_api.h>
|
||||
#include <string_view>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using namespace nvinfer1;
|
||||
using namespace plugin;
|
||||
using nvinfer1::plugin::MultilevelCropAndResize;
|
||||
using nvinfer1::plugin::MultilevelCropAndResizePluginCreator;
|
||||
|
||||
namespace
|
||||
{
|
||||
char const* const kMULTILEVELCROPANDRESIZE_PLUGIN_VERSION{"1"};
|
||||
char const* const kMULTILEVELCROPANDRESIZE_PLUGIN_NAME{"MultilevelCropAndResize_TRT"};
|
||||
} // namespace
|
||||
|
||||
MultilevelCropAndResizePluginCreator::MultilevelCropAndResizePluginCreator() noexcept
|
||||
{
|
||||
mPluginAttributes.clear();
|
||||
mPluginAttributes.emplace_back(PluginField("pooled_size", nullptr, PluginFieldType::kINT32, 1));
|
||||
mPluginAttributes.emplace_back(PluginField("image_size", nullptr, PluginFieldType::kINT32, 3));
|
||||
|
||||
mFC.nbFields = mPluginAttributes.size();
|
||||
mFC.fields = mPluginAttributes.data();
|
||||
}
|
||||
|
||||
char const* MultilevelCropAndResizePluginCreator::getPluginName() const noexcept
|
||||
{
|
||||
return kMULTILEVELCROPANDRESIZE_PLUGIN_NAME;
|
||||
}
|
||||
|
||||
char const* MultilevelCropAndResizePluginCreator::getPluginVersion() const noexcept
|
||||
{
|
||||
return kMULTILEVELCROPANDRESIZE_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
PluginFieldCollection const* MultilevelCropAndResizePluginCreator::getFieldNames() noexcept
|
||||
{
|
||||
return &mFC;
|
||||
}
|
||||
|
||||
IPluginV2Ext* MultilevelCropAndResizePluginCreator::createPlugin(
|
||||
char const* name, PluginFieldCollection const* fc) noexcept
|
||||
{
|
||||
try
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
plugin::validateRequiredAttributesExist({"pooled_size"}, fc);
|
||||
|
||||
auto imageSize = TLTMaskRCNNConfig::IMAGE_SHAPE;
|
||||
PluginField const* fields = fc->fields;
|
||||
for (int32_t i = 0; i < fc->nbFields; ++i)
|
||||
{
|
||||
std::string_view const attrName = fields[i].name;
|
||||
if (attrName == "pooled_size"sv)
|
||||
{
|
||||
PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
|
||||
mPooledSize = *(static_cast<int32_t const*>(fields[i].data));
|
||||
}
|
||||
if (attrName == "image_size"sv)
|
||||
{
|
||||
PLUGIN_VALIDATE(fields[i].type == PluginFieldType::kINT32);
|
||||
auto const dims = static_cast<int32_t const*>(fields[i].data);
|
||||
std::copy_n(dims, 3, imageSize.d);
|
||||
}
|
||||
}
|
||||
return new MultilevelCropAndResize(mPooledSize, imageSize);
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
caughtError(e);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IPluginV2Ext* MultilevelCropAndResizePluginCreator::deserializePlugin(
|
||||
char const* name, void const* data, size_t length) noexcept
|
||||
{
|
||||
try
|
||||
{
|
||||
return new MultilevelCropAndResize(data, length);
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
caughtError(e);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MultilevelCropAndResize::MultilevelCropAndResize(int32_t pooled_size, nvinfer1::Dims const& imageSize)
|
||||
: mPooledSize({pooled_size, pooled_size})
|
||||
{
|
||||
|
||||
PLUGIN_VALIDATE(pooled_size > 0);
|
||||
PLUGIN_VALIDATE(imageSize.nbDims == 3);
|
||||
PLUGIN_VALIDATE(imageSize.d[0] > 0 && imageSize.d[1] > 0 && imageSize.d[2] > 0);
|
||||
// shape
|
||||
mInputHeight = imageSize.d[1];
|
||||
mInputWidth = imageSize.d[2];
|
||||
// Threshold to P3: Smaller -> P2
|
||||
mThresh = (224 * 224) / (4.0F);
|
||||
}
|
||||
|
||||
int32_t MultilevelCropAndResize::getNbOutputs() const noexcept
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t MultilevelCropAndResize::initialize() noexcept
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MultilevelCropAndResize::terminate() noexcept {}
|
||||
|
||||
void MultilevelCropAndResize::destroy() noexcept
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
size_t MultilevelCropAndResize::getWorkspaceSize(int32_t) const noexcept
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool MultilevelCropAndResize::supportsFormat(DataType type, PluginFormat format) const noexcept
|
||||
{
|
||||
return ((type == DataType::kFLOAT || type == DataType::kHALF) && format == PluginFormat::kLINEAR);
|
||||
}
|
||||
|
||||
char const* MultilevelCropAndResize::getPluginType() const noexcept
|
||||
{
|
||||
return "MultilevelCropAndResize_TRT";
|
||||
}
|
||||
|
||||
char const* MultilevelCropAndResize::getPluginVersion() const noexcept
|
||||
{
|
||||
return "1";
|
||||
}
|
||||
|
||||
IPluginV2Ext* MultilevelCropAndResize::clone() const noexcept
|
||||
{
|
||||
try
|
||||
{
|
||||
return new MultilevelCropAndResize(*this);
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
caughtError(e);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void MultilevelCropAndResize::setPluginNamespace(char const* libNamespace) noexcept
|
||||
{
|
||||
mNameSpace = libNamespace;
|
||||
}
|
||||
|
||||
char const* MultilevelCropAndResize::getPluginNamespace() const noexcept
|
||||
{
|
||||
return mNameSpace.c_str();
|
||||
}
|
||||
|
||||
void MultilevelCropAndResize::check_valid_inputs(nvinfer1::Dims const* inputs, int32_t nbInputDims) noexcept
|
||||
{
|
||||
// to be compatible with tensorflow node's input:
|
||||
// roi: [N, anchors, 4],
|
||||
// feature_map list(5 maps): p2, p3, p4, p5, p6
|
||||
PLUGIN_ASSERT(nbInputDims == 1 + mFeatureMapCount);
|
||||
|
||||
nvinfer1::Dims rois = inputs[0];
|
||||
PLUGIN_ASSERT(rois.nbDims == 2);
|
||||
PLUGIN_ASSERT(rois.d[1] == 4);
|
||||
|
||||
for (int32_t i = 1; i < nbInputDims; ++i)
|
||||
{
|
||||
nvinfer1::Dims dims = inputs[i];
|
||||
|
||||
// CHW with the same #C
|
||||
PLUGIN_ASSERT(dims.nbDims == 3 && dims.d[0] == inputs[1].d[0]);
|
||||
}
|
||||
}
|
||||
|
||||
Dims MultilevelCropAndResize::getOutputDimensions(int32_t index, Dims const* inputs, int32_t nbInputDims) noexcept
|
||||
{
|
||||
|
||||
check_valid_inputs(inputs, nbInputDims);
|
||||
PLUGIN_ASSERT(index == 0);
|
||||
|
||||
nvinfer1::Dims result{};
|
||||
result.nbDims = 4;
|
||||
|
||||
// mROICount
|
||||
result.d[0] = inputs[0].d[0];
|
||||
// mFeatureLength
|
||||
result.d[1] = inputs[1].d[0];
|
||||
// height
|
||||
result.d[2] = mPooledSize.y;
|
||||
// width
|
||||
result.d[3] = mPooledSize.x;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t MultilevelCropAndResize::enqueue(
|
||||
int32_t batch_size, void const* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream) noexcept
|
||||
{
|
||||
|
||||
void* pooled = outputs[0];
|
||||
|
||||
cudaError_t status = roiAlignHalfCenter(stream, batch_size, mFeatureLength, mROICount, mThresh,
|
||||
|
||||
mInputHeight, mInputWidth, inputs[0], &inputs[1], mFeatureSpatialSize,
|
||||
|
||||
pooled, mPooledSize, mPrecision);
|
||||
|
||||
PLUGIN_ASSERT(status == cudaSuccess);
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t MultilevelCropAndResize::getSerializationSize() const noexcept
|
||||
{
|
||||
return sizeof(int32_t) * 2 + sizeof(int32_t) * 4 + sizeof(float) + sizeof(int32_t) * 2 * mFeatureMapCount
|
||||
+ sizeof(DataType);
|
||||
}
|
||||
|
||||
void MultilevelCropAndResize::serialize(void* buffer) const noexcept
|
||||
{
|
||||
char *d = reinterpret_cast<char*>(buffer), *a = d;
|
||||
write(d, mPooledSize.y);
|
||||
write(d, mPooledSize.x);
|
||||
write(d, mFeatureLength);
|
||||
write(d, mROICount);
|
||||
write(d, mInputHeight);
|
||||
write(d, mInputWidth);
|
||||
write(d, mThresh);
|
||||
for (int32_t i = 0; i < mFeatureMapCount; i++)
|
||||
{
|
||||
write(d, mFeatureSpatialSize[i].y);
|
||||
write(d, mFeatureSpatialSize[i].x);
|
||||
}
|
||||
write(d, mPrecision);
|
||||
PLUGIN_ASSERT(d == a + getSerializationSize());
|
||||
}
|
||||
MultilevelCropAndResize::MultilevelCropAndResize(void const* data, size_t length)
|
||||
{
|
||||
deserialize(static_cast<int8_t const*>(data), length);
|
||||
}
|
||||
|
||||
void MultilevelCropAndResize::deserialize(int8_t const* data, size_t length)
|
||||
{
|
||||
auto const* d{data};
|
||||
mPooledSize = {read<int32_t>(d), read<int32_t>(d)};
|
||||
mFeatureLength = read<int32_t>(d);
|
||||
mROICount = read<int32_t>(d);
|
||||
mInputHeight = read<int32_t>(d);
|
||||
mInputWidth = read<int32_t>(d);
|
||||
mThresh = read<float>(d);
|
||||
for (int32_t i = 0; i < mFeatureMapCount; i++)
|
||||
{
|
||||
mFeatureSpatialSize[i].y = read<int32_t>(d);
|
||||
mFeatureSpatialSize[i].x = read<int32_t>(d);
|
||||
}
|
||||
mPrecision = read<DataType>(d);
|
||||
PLUGIN_VALIDATE(d == static_cast<int8_t const*>(data) + length);
|
||||
}
|
||||
|
||||
// Return the DataType of the plugin output at the requested index
|
||||
DataType MultilevelCropAndResize::getOutputDataType(
|
||||
int32_t index, nvinfer1::DataType const* inputTypes, int32_t nbInputs) const noexcept
|
||||
{
|
||||
// Only DataType::kFLOAT is acceptable by the plugin layer
|
||||
// return DataType::kFLOAT;
|
||||
// Align output types with the input feature map data types
|
||||
if ((inputTypes[1] == DataType::kFLOAT) || (inputTypes[1] == DataType::kHALF))
|
||||
return inputTypes[1];
|
||||
|
||||
return DataType::kFLOAT;
|
||||
}
|
||||
|
||||
// Configure the layer with input and output data types.
|
||||
void MultilevelCropAndResize::configurePlugin(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims,
|
||||
int32_t nbOutputs, DataType const* inputTypes, DataType const* outputTypes, bool const* inputIsBroadcast,
|
||||
bool const* outputIsBroadcast, PluginFormat floatFormat, int32_t maxBatchSize) noexcept
|
||||
{
|
||||
PLUGIN_ASSERT(supportsFormat(inputTypes[0], floatFormat));
|
||||
check_valid_inputs(inputDims, nbInputs);
|
||||
|
||||
PLUGIN_ASSERT(nbOutputs == 1);
|
||||
PLUGIN_ASSERT(nbInputs == 1 + mFeatureMapCount);
|
||||
|
||||
try
|
||||
{
|
||||
mROICount = dimToInt32(inputDims[0].d[0]);
|
||||
mFeatureLength = dimToInt32(inputDims[1].d[0]);
|
||||
|
||||
for (size_t layer = 0; layer < mFeatureMapCount; ++layer)
|
||||
{
|
||||
mFeatureSpatialSize[layer] = {dimToInt32(inputDims[layer + 1].d[1]), dimToInt32(inputDims[layer + 1].d[2])};
|
||||
}
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
caughtError(e);
|
||||
}
|
||||
|
||||
mPrecision = inputTypes[1];
|
||||
}
|
||||
|
||||
// Attach the plugin object to an execution context and grant the plugin the access to some context resource.
|
||||
void MultilevelCropAndResize::attachToContext(
|
||||
cudnnContext* cudnnContext, cublasContext* cublasContext, IGpuAllocator* gpuAllocator) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
// Detach the plugin object from its execution context.
|
||||
void MultilevelCropAndResize::detachFromContext() noexcept {}
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TRT_MULTILEVEL_CROP_AND_RESIZE_PLUGIN_H
|
||||
#define TRT_MULTILEVEL_CROP_AND_RESIZE_PLUGIN_H
|
||||
|
||||
#include <cuda_runtime_api.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "NvInfer.h"
|
||||
#include "NvInferPlugin.h"
|
||||
#include "common/kernels/maskRCNNKernels.h"
|
||||
#include "multilevelProposeROI/tlt_mrcnn_config.h"
|
||||
|
||||
namespace nvinfer1
|
||||
{
|
||||
namespace plugin
|
||||
{
|
||||
|
||||
class MultilevelCropAndResize : public IPluginV2Ext
|
||||
{
|
||||
public:
|
||||
MultilevelCropAndResize(int32_t pooled_size, nvinfer1::Dims const& image_size);
|
||||
|
||||
MultilevelCropAndResize(void const* data, size_t length);
|
||||
|
||||
~MultilevelCropAndResize() noexcept override = default;
|
||||
|
||||
int32_t getNbOutputs() const noexcept override;
|
||||
|
||||
Dims getOutputDimensions(int32_t index, Dims const* inputs, int32_t nbInputDims) noexcept override;
|
||||
|
||||
int32_t initialize() noexcept override;
|
||||
|
||||
void terminate() noexcept override;
|
||||
|
||||
void destroy() noexcept override;
|
||||
|
||||
size_t getWorkspaceSize(int32_t) const noexcept override;
|
||||
|
||||
int32_t enqueue(int32_t batch_size, void const* const* inputs, void* const* outputs, void* workspace,
|
||||
cudaStream_t stream) noexcept override;
|
||||
|
||||
size_t getSerializationSize() const noexcept override;
|
||||
|
||||
void serialize(void* buffer) const noexcept override;
|
||||
|
||||
bool supportsFormat(DataType type, PluginFormat format) const noexcept override;
|
||||
|
||||
char const* getPluginType() const noexcept override;
|
||||
|
||||
char const* getPluginVersion() const noexcept override;
|
||||
|
||||
IPluginV2Ext* clone() const noexcept override;
|
||||
|
||||
void setPluginNamespace(char const* libNamespace) noexcept override;
|
||||
|
||||
char const* getPluginNamespace() const noexcept override;
|
||||
|
||||
DataType getOutputDataType(
|
||||
int32_t index, nvinfer1::DataType const* inputTypes, int32_t nbInputs) const noexcept override;
|
||||
|
||||
void attachToContext(
|
||||
cudnnContext* cudnnContext, cublasContext* cublasContext, IGpuAllocator* gpuAllocator) noexcept override;
|
||||
|
||||
void configurePlugin(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims, int32_t nbOutputs,
|
||||
DataType const* inputTypes, DataType const* outputTypes, bool const* inputIsBroadcast,
|
||||
bool const* outputIsBroadcast, PluginFormat floatFormat, int32_t maxBatchSize) noexcept override;
|
||||
|
||||
void detachFromContext() noexcept override;
|
||||
|
||||
private:
|
||||
void deserialize(int8_t const* data, size_t length);
|
||||
void check_valid_inputs(nvinfer1::Dims const* inputs, int32_t nbInputDims) noexcept;
|
||||
|
||||
xy_t mPooledSize{};
|
||||
static const int32_t mFeatureMapCount = 5; // p2, p3, p4, p5, p6(Maxpooling)
|
||||
int32_t mFeatureLength{};
|
||||
int32_t mROICount{};
|
||||
float mThresh{};
|
||||
int32_t mInputHeight;
|
||||
int32_t mInputWidth{};
|
||||
xy_t mFeatureSpatialSize[mFeatureMapCount]{};
|
||||
std::string mNameSpace;
|
||||
DataType mPrecision{};
|
||||
};
|
||||
|
||||
class MultilevelCropAndResizePluginCreator : public nvinfer1::pluginInternal::BaseCreator
|
||||
{
|
||||
public:
|
||||
MultilevelCropAndResizePluginCreator() noexcept;
|
||||
|
||||
~MultilevelCropAndResizePluginCreator() noexcept override {}
|
||||
|
||||
char const* getPluginName() const noexcept override;
|
||||
|
||||
char const* getPluginVersion() const noexcept override;
|
||||
|
||||
PluginFieldCollection const* getFieldNames() noexcept override;
|
||||
|
||||
IPluginV2Ext* createPlugin(char const* name, PluginFieldCollection const* fc) noexcept override;
|
||||
|
||||
IPluginV2Ext* deserializePlugin(char const* name, void const* data, size_t length) noexcept override;
|
||||
|
||||
private:
|
||||
PluginFieldCollection mFC;
|
||||
int32_t mPooledSize;
|
||||
std::vector<PluginField> mPluginAttributes;
|
||||
};
|
||||
} // namespace plugin
|
||||
} // namespace nvinfer1
|
||||
#endif // TRT_MULTILEVEL_CROP_AND_RESIZE_PLUGIN_H
|
||||
Reference in New Issue
Block a user