| 101 | |
| 102 | |
| 103 | void CalculateStridedSliceOutputTensorInfo(const armnn::TensorInfo& inputTensorInfo, |
| 104 | const armnn::StridedSliceDescriptor& desc, |
| 105 | armnn::TensorInfo& outputTensorInfo) |
| 106 | { |
| 107 | const armnn::TensorShape& inputShape = inputTensorInfo.GetShape(); |
| 108 | |
| 109 | std::vector<unsigned int> outputShapeVector; |
| 110 | for (unsigned int i = 0; i < inputTensorInfo.GetNumDimensions(); i++) |
| 111 | { |
| 112 | if (desc.m_ShrinkAxisMask & (1 << i)) |
| 113 | { |
| 114 | continue; |
| 115 | } |
| 116 | |
| 117 | int stride = desc.m_Stride[i]; |
| 118 | int start = desc.GetStartForAxis(inputShape, i); |
| 119 | int stop = desc.GetStopForAxis(inputShape, i, start); |
| 120 | |
| 121 | int newSize = stride > 0 ? ((stop - start) + stride - 1) / stride : |
| 122 | ((start - stop) - stride - 1) / -stride; |
| 123 | |
| 124 | newSize = std::max(0, newSize); |
| 125 | |
| 126 | outputShapeVector.push_back(static_cast<unsigned int>(newSize)); |
| 127 | } |
| 128 | |
| 129 | armnn::TensorShape outputTensorShape(inputTensorInfo.GetNumDimensions(), &outputShapeVector[0]); |
| 130 | outputTensorInfo = armnn::TensorInfo(armnn::TensorShape(outputTensorShape), inputTensorInfo.GetDataType()); |
| 131 | } |
| 132 | } // namespace armnnUtils |
nothing calls this directly
no test coverage detected