MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / init

Method init

src/runtime/TensorAllocator.cpp:106–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106void TensorAllocator::init(const TensorAllocator &allocator, const Coordinates &coords, TensorInfo &sub_info)
107{
108 // Get parent info
109 const TensorInfo parent_info = allocator.info();
110
111 // Check if coordinates and new shape are within the parent tensor
112 ARM_COMPUTE_ERROR_ON(!validate_subtensor_shape(parent_info, sub_info, coords));
113 ARM_COMPUTE_UNUSED(validate_subtensor_shape);
114
115 // Copy pointer to buffer
116 _memory = Memory(allocator._memory.region());
117
118 // Init tensor info with new dimensions
119 size_t total_size =
120 parent_info.offset_element_in_bytes(coords) + sub_info.total_size() - sub_info.offset_first_element_in_bytes();
121 sub_info.init(sub_info.tensor_shape(), sub_info.format(), parent_info.strides_in_bytes(),
122 parent_info.offset_element_in_bytes(coords), total_size);
123
124 // Set TensorInfo
125 init(sub_info);
126}
127
128uint8_t *TensorAllocator::data() const
129{

Callers

nothing calls this directly

Calls 9

validate_subtensor_shapeFunction · 0.85
initFunction · 0.70
MemoryClass · 0.50
infoMethod · 0.45
regionMethod · 0.45
total_sizeMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected