Fix ISliceLayer
This commit is contained in:
@@ -10,19 +10,20 @@
|
||||
nvinfer1::ITensor*
|
||||
shortcutLayer(int layerIdx, std::string activation, std::string inputVol, std::string shortcutVol,
|
||||
std::map<std::string, std::string>& block, nvinfer1::ITensor* input, nvinfer1::ITensor* shortcutInput,
|
||||
nvinfer1::INetworkDefinition* network)
|
||||
nvinfer1::INetworkDefinition* network, uint batchSize)
|
||||
{
|
||||
nvinfer1::ITensor* output;
|
||||
|
||||
assert(block.at("type") == "shortcut");
|
||||
|
||||
if (inputVol != shortcutVol) {
|
||||
nvinfer1::ISliceLayer* slice = network->addSlice(*shortcutInput, nvinfer1::Dims{4, {0, 0, 0, 0}}, input->getDimensions(),
|
||||
nvinfer1::Dims{4, {1, 1, 1, 1}});
|
||||
assert(slice != nullptr);
|
||||
std::string sliceLayerName = "slice_" + std::to_string(layerIdx);
|
||||
slice->setName(sliceLayerName.c_str());
|
||||
output = slice->getOutput(0);
|
||||
std::string name = "slice";
|
||||
nvinfer1::Dims start = {4, {0, 0, 0, 0}};
|
||||
nvinfer1::Dims size = input->getDimensions();
|
||||
nvinfer1::Dims stride = nvinfer1::Dims{4, {1, 1, 1, 1}};
|
||||
|
||||
output = sliceLayer(layerIdx, name, shortcutInput, start, size, stride, network, batchSize);
|
||||
assert(output != nullptr);
|
||||
}
|
||||
else
|
||||
output = shortcutInput;
|
||||
|
||||
Reference in New Issue
Block a user