a336126733
This reverts commitac0d6e928e, reversing changes made to40266a6c32.
105 lines
3.5 KiB
C++
105 lines
3.5 KiB
C++
#include<cassert>
|
|
#include "../kernels.h"
|
|
#include <NvInfer.h>
|
|
#include <vector>
|
|
#include <utils.h>
|
|
|
|
namespace nvinfer1 {
|
|
|
|
class ResizeLayerRT : public IPluginV2Ext {
|
|
|
|
public:
|
|
ResizeLayerRT(int oc, int oh, int ow,int ic,int ih,int iw) ;
|
|
|
|
ResizeLayerRT(const void *data, size_t length) ;
|
|
|
|
~ResizeLayerRT() ;
|
|
|
|
int getNbOutputs() const NOEXCEPT override ;
|
|
|
|
Dims getOutputDimensions(int index, const Dims *inputs, int nbInputDims) NOEXCEPT override ;
|
|
|
|
int initialize() NOEXCEPT override ;
|
|
|
|
void terminate() NOEXCEPT override ;
|
|
|
|
size_t getWorkspaceSize(int maxBatchSize) const NOEXCEPT override ;
|
|
|
|
#if NV_TENSORRT_MAJOR > 7
|
|
int enqueue(int batchSize, const void *const *inputs, void *const *outputs, void *workspace,
|
|
cudaStream_t stream) NOEXCEPT override ;
|
|
#elif NV_TENSORRT_MAJOR <= 7
|
|
int32_t enqueue (int32_t batchSize, const void *const *inputs, void **outputs, void *workspace, cudaStream_t stream) override;
|
|
#endif
|
|
|
|
size_t getSerializationSize() const NOEXCEPT override ;
|
|
|
|
void serialize(void *buffer) const NOEXCEPT override ;
|
|
|
|
bool supportsFormat(DataType type, PluginFormat format) const NOEXCEPT override ;
|
|
|
|
const char *getPluginType() const NOEXCEPT override ;
|
|
|
|
const char *getPluginVersion() const NOEXCEPT override ;
|
|
|
|
void destroy() NOEXCEPT override ;
|
|
|
|
const char *getPluginNamespace() const NOEXCEPT override ;
|
|
|
|
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
|
|
|
IPluginV2Ext *clone() const NOEXCEPT override ;
|
|
|
|
DataType getOutputDataType(int index, const nvinfer1::DataType* inputTypes, int nbInputs) const NOEXCEPT override;
|
|
|
|
void attachToContext(cudnnContext* cudnnContext, cublasContext* cublasContext, IGpuAllocator* gpuAllocator) NOEXCEPT override;
|
|
|
|
bool isOutputBroadcastAcrossBatch(int outputIndex, const bool* inputIsBroadcasted, int nbInputs) const NOEXCEPT override;
|
|
|
|
bool canBroadcastInputAcrossBatch(int inputIndex) const 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;
|
|
|
|
int i_c, i_h, i_w, o_c, o_h, o_w;
|
|
|
|
private:
|
|
std::string mPluginNamespace;
|
|
};
|
|
|
|
class ResizeLayerRTPluginCreator : public IPluginCreator {
|
|
public:
|
|
ResizeLayerRTPluginCreator() ;
|
|
|
|
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
|
|
|
const char *getPluginNamespace() const NOEXCEPT override ;
|
|
|
|
IPluginV2Ext *deserializePlugin(const char *name, const void *serialData, size_t serialLength) NOEXCEPT override ;
|
|
|
|
IPluginV2Ext *createPlugin(const char *name, const PluginFieldCollection *fc) NOEXCEPT override ;
|
|
|
|
const char *getPluginName() const NOEXCEPT override ;
|
|
|
|
const char *getPluginVersion() const NOEXCEPT override ;
|
|
|
|
const PluginFieldCollection *getFieldNames() NOEXCEPT override ;
|
|
|
|
|
|
|
|
|
|
private:
|
|
static PluginFieldCollection mFC;
|
|
static std::vector<PluginField> mPluginAttributes;
|
|
std::string mPluginNamespace;
|
|
|
|
};
|
|
|
|
REGISTER_TENSORRT_PLUGIN(ResizeLayerRTPluginCreator);
|
|
};
|
|
|