| 220 | } |
| 221 | |
| 222 | std::unique_ptr<ITensorHandle> ClWorkloadFactory::CreateSubTensorHandle(ITensorHandle& parent, |
| 223 | TensorShape const& subTensorShape, |
| 224 | unsigned int const* subTensorOrigin) const |
| 225 | { |
| 226 | arm_compute::Coordinates coords; |
| 227 | arm_compute::TensorShape shape = armcomputetensorutils::BuildArmComputeTensorShape(subTensorShape); |
| 228 | |
| 229 | coords.set_num_dimensions(subTensorShape.GetNumDimensions()); |
| 230 | for (unsigned int i = 0; i < subTensorShape.GetNumDimensions(); i++) |
| 231 | { |
| 232 | // Arm compute indexes tensor coords in reverse order. |
| 233 | unsigned int revertedIndex = subTensorShape.GetNumDimensions() - i - 1; |
| 234 | coords.set(i, armnn::numeric_cast<int>(subTensorOrigin[revertedIndex])); |
| 235 | } |
| 236 | |
| 237 | const arm_compute::TensorShape parentShape = armcomputetensorutils::BuildArmComputeTensorShape(parent.GetShape()); |
| 238 | if (!::arm_compute::error_on_invalid_subtensor(__func__, __FILE__, __LINE__, parentShape, coords, shape)) |
| 239 | { |
| 240 | return nullptr; |
| 241 | } |
| 242 | |
| 243 | return std::make_unique<ClSubTensorHandle>( |
| 244 | PolymorphicDowncast<IClTensorHandle*>(&parent), shape, coords); |
| 245 | } |
| 246 | |
| 247 | std::unique_ptr<IWorkload> ClWorkloadFactory::CreateWorkload(LayerType type, |
| 248 | const QueueDescriptor& descriptor, |