last_conv->setPadding(DimsHW{0, 0});
IActivationLayer* relu1 = network->addActivation(*last_conv->getOutput(0), ActivationType::kRELU);
std::cout << relu1->getOutput(0)->getDimensions() << std::endl;
IPoolingLayer* avg_pool = network->addPooling(*relu1->getOutput(0),PoolingType::kAVERAGE,DimsHW{7,7});
assert(avg_pool);
std::cout << avg_pool->getOutput(0)->getDimensions() << std::endl;
//add the plugin to the TensorRT network using the network API
nvinfer1::ITensor* const* point = (nvinfer1::ITensor* const*) &(*avg_pool->getOutput(0));
nvinfer1::PluginFieldCollection plugfc;
plugfc.nbFields = 0;
plugfc.fields = nullptr;
nvinfer1::IPluginV2* pluginV2 = getPluginRegistry()->getPluginCreator("Identity", "2")->createPlugin("testing", &plugfc);
assert(pluginV2);
auto layer = network->addPluginV2(point, 1280 * 4, *pluginV2);
layer->setName("testing");
nvinfer1::Weights fc_weight, fc_bias;
auto arr4 = cnpy::npy_load("mbnetv2/final_dense_kernel.npy");
fc_weight.values = arr4.data<short>();
fc_weight.count = arr4.shape[0] * arr4.shape[1];
auto arr5 = cnpy::npy_load("mbnetv2/final_dense_bias.npy");
fc_bias.values = arr5.data<short>();
fc_bias.count = arr5.shape[0];
fc_weight.type = DataType::kHALF;
fc_bias.type = DataType::kHALF;
IFullyConnectedLayer * fc = network->addFullyConnected(*layer->getOutput(0), 1000, fc_weight, fc_bias);