| 104 | } |
| 105 | |
| 106 | void 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 | |
| 128 | uint8_t *TensorAllocator::data() const |
| 129 | { |
nothing calls this directly
no test coverage detected