| 50 | } |
| 51 | |
| 52 | void CalculateReducedOutputTensoInfo(const armnn::TensorInfo& inputTensorInfo, |
| 53 | const std::set<unsigned int>& axisSet, |
| 54 | bool keepDims, |
| 55 | armnn::TensorInfo& outputTensorInfo) |
| 56 | { |
| 57 | std::vector<unsigned int> outputShapeVector; |
| 58 | bool dimensionFound = false; |
| 59 | unsigned int size = 1; |
| 60 | |
| 61 | for (unsigned int i = 0; i < inputTensorInfo.GetNumDimensions(); ++i) |
| 62 | { |
| 63 | dimensionFound = false; |
| 64 | for (unsigned int axis: axisSet) |
| 65 | { |
| 66 | if (axis == i) |
| 67 | { |
| 68 | dimensionFound = true; |
| 69 | break; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | if (!dimensionFound) |
| 74 | { |
| 75 | size *= inputTensorInfo.GetShape()[i]; |
| 76 | |
| 77 | if (keepDims) |
| 78 | { |
| 79 | outputShapeVector.push_back(inputTensorInfo.GetShape()[i]); |
| 80 | } |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | if (keepDims) |
| 85 | { |
| 86 | outputShapeVector.push_back(1); |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | if (keepDims) |
| 92 | { |
| 93 | armnn::TensorShape outputTensorShape(inputTensorInfo.GetNumDimensions(), &outputShapeVector[0]); |
| 94 | outputTensorInfo = armnn::TensorInfo(outputTensorShape, inputTensorInfo.GetDataType()); |
| 95 | } |
| 96 | else |
| 97 | { |
| 98 | outputTensorInfo = armnn::TensorInfo({size}, inputTensorInfo.GetDataType()); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | |
| 103 | void CalculateStridedSliceOutputTensorInfo(const armnn::TensorInfo& inputTensorInfo, |
no test coverage detected