MCPcopy Create free account
hub / github.com/ARM-software/armnn / CreateSubTensorHandle

Method CreateSubTensorHandle

src/backends/cl/ClWorkloadFactory.cpp:222–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222std::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
247std::unique_ptr<IWorkload> ClWorkloadFactory::CreateWorkload(LayerType type,
248 const QueueDescriptor& descriptor,

Callers 2

MemCopyTestFunction · 0.45

Calls 4

GetNumDimensionsMethod · 0.45
setMethod · 0.45
GetShapeMethod · 0.45

Tested by 1

MemCopyTestFunction · 0.36