13 #include <arm_compute/core/Coordinates.h>
14 #include <arm_compute/runtime/CL/CLSubTensor.h>
15 #include <arm_compute/runtime/CL/CLTensor.h>
24 const unsigned int* subTensorOrigin)
const
27 arm_compute::TensorShape shape = armcomputetensorutils::BuildArmComputeTensorShape(subTensorShape);
34 coords.set(i, armnn::numeric_cast<int>(subTensorOrigin[revertedIndex]));
37 const arm_compute::TensorShape parentShape = armcomputetensorutils::BuildArmComputeTensorShape(parent.
GetShape());
41 if (coords.x() != 0 || coords.y() != 0)
45 if ((parentShape.x() != shape.x()) || (parentShape.y() != shape.y()))
50 if (!::arm_compute::error_on_invalid_subtensor(__func__, __FILE__, __LINE__, parentShape, coords, shape))
55 return std::make_unique<ClSubTensorHandle>(PolymorphicDowncast<IClTensorHandle*>(&parent), shape, coords);
70 const bool IsMemoryManaged)
const
72 std::unique_ptr<ClTensorHandle> tensorHandle = std::make_unique<ClTensorHandle>(tensorInfo);
75 ARMNN_LOG(
warning) <<
"ClTensorHandleFactory only has support for memory managed.";
77 tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup());
83 const bool IsMemoryManaged)
const
85 std::unique_ptr<ClTensorHandle> tensorHandle = std::make_unique<ClTensorHandle>(tensorInfo, dataLayout);
88 ARMNN_LOG(
warning) <<
"ClTensorHandleFactory only has support for memory managed.";
90 tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup());
#define ARMNN_LOG(severity)
const FactoryId & GetId() const override
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
MemorySourceFlags GetExportFlags() const override
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, const TensorShape &subTensorShape, const unsigned int *subTensorOrigin) const override
MemorySourceFlags GetImportFlags() const override
static const FactoryId & GetIdStatic()
bool SupportsSubTensors() const override
virtual TensorShape GetShape() const =0
Get the number of elements for each dimension ordered from slowest iterating dimension to fastest ite...
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Copyright (c) 2021 ARM Limited and Contributors.
unsigned int MemorySourceFlags
ITensorHandleFactory::FactoryId FactoryId
std::array< unsigned int, MaxNumOfTensorDimensions > Coordinates
constexpr const char * ClTensorHandleFactoryId()