12 #include <arm_compute/core/Coordinates.h> 13 #include <arm_compute/runtime/CL/CLSubTensor.h> 14 #include <arm_compute/runtime/CL/CLTensor.h> 23 const unsigned int* subTensorOrigin)
const 26 arm_compute::TensorShape shape = armcomputetensorutils::BuildArmComputeTensorShape(subTensorShape);
33 coords.set(i, armnn::numeric_cast<int>(subTensorOrigin[revertedIndex]));
36 const arm_compute::TensorShape parentShape = armcomputetensorutils::BuildArmComputeTensorShape(parent.
GetShape());
40 if (coords.x() != 0 || coords.y() != 0)
44 if ((parentShape.x() != shape.x()) || (parentShape.y() != shape.y()))
49 if (!::arm_compute::error_on_invalid_subtensor(__func__, __FILE__, __LINE__, parentShape, coords, shape))
54 return std::make_unique<ClSubTensorHandle>(PolymorphicDowncast<IClTensorHandle*>(&parent), shape, coords);
69 const bool IsMemoryManaged)
const 71 std::unique_ptr<ClTensorHandle> tensorHandle = std::make_unique<ClTensorHandle>(tensorInfo);
74 ARMNN_LOG(
warning) <<
"ClTensorHandleFactory only has support for memory managed.";
76 tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup());
82 const bool IsMemoryManaged)
const 84 std::unique_ptr<ClTensorHandle> tensorHandle = std::make_unique<ClTensorHandle>(tensorInfo, dataLayout);
87 ARMNN_LOG(
warning) <<
"ClTensorHandleFactory only has support for memory managed.";
89 tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup());
111 return m_ExportFlags;
116 return m_ImportFlags;
static const FactoryId & GetIdStatic()
bool SupportsSubTensors() const override
MemorySourceFlags GetImportFlags() const override
std::array< unsigned int, MaxNumOfTensorDimensions > Coordinates
#define ARMNN_LOG(severity)
unsigned int MemorySourceFlags
Copyright (c) 2021 ARM Limited and Contributors.
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, const TensorShape &subTensorShape, const unsigned int *subTensorOrigin) const override
MemorySourceFlags GetExportFlags() const override
constexpr const char * ClTensorHandleFactoryId()
ITensorHandleFactory::FactoryId FactoryId
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) 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.
const FactoryId & GetId() const override