13 #include <arm_compute/runtime/CL/CLTensor.h> 14 #include <arm_compute/core/Coordinates.h> 15 #include <arm_compute/runtime/CL/CLSubTensor.h> 25 const unsigned int* subTensorOrigin)
const 28 arm_compute::TensorShape shape = armcomputetensorutils::BuildArmComputeTensorShape(subTensorShape);
35 coords.set(i, armnn::numeric_cast<int>(subTensorOrigin[revertedIndex]));
38 const arm_compute::TensorShape parentShape = armcomputetensorutils::BuildArmComputeTensorShape(
43 if (coords.x() != 0 || coords.y() != 0)
47 if ((parentShape.x() != shape.x()) || (parentShape.y() != shape.y()))
52 if (!::arm_compute::error_on_invalid_subtensor(__func__, __FILE__, __LINE__, parentShape, coords, shape))
57 return std::make_unique<ClSubTensorHandle>(
58 PolymorphicDowncast<IClTensorHandle *>(&parent), shape, coords);
73 const bool IsMemoryManaged)
const 75 std::unique_ptr<ClTensorHandle> tensorHandle = std::make_unique<ClTensorHandle>(tensorInfo);
78 ARMNN_LOG(
warning) <<
"ClTensorHandleFactory only has support for memory managed.";
80 tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup());
86 const bool IsMemoryManaged)
const 88 std::unique_ptr<ClTensorHandle> tensorHandle = std::make_unique<ClTensorHandle>(tensorInfo, dataLayout);
91 ARMNN_LOG(
warning) <<
"ClTensorHandleFactory only has support for memory managed.";
93 tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup());
115 return m_ExportFlags;
120 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) 2020 ARM Limited.
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