[CPU] Fixed NMS output memory redifinition logic (#21126)

CPU graph always adds Result node for outputs which don't have consumers. If Conversion is inserted between such output and Result this Conversion became consumer and require defined memory.
This commit is contained in:
Nikolay Shchegolev 2023-11-28 17:58:33 +04:00 committed by GitHub
parent d3d3ee55ef
commit c6d78def6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -285,13 +285,13 @@ void NonMaxSuppression::execute(dnnl::stream strm) {
const size_t valid_outputs = std::min(start_offset, max_number_of_boxes); const size_t valid_outputs = std::min(start_offset, max_number_of_boxes);
const size_t stride = 3lu;
if (!m_out_static_shape) {
VectorDims new_dims{valid_outputs, stride};
redefineOutputMemory({new_dims, new_dims, {1}});
}
if (m_defined_outputs[NMS_SELECTED_INDICES]) { if (m_defined_outputs[NMS_SELECTED_INDICES]) {
const size_t stride = 3lu;
if (!m_out_static_shape) {
redefineOutputMemory(NMS_SELECTED_INDICES, { valid_outputs, stride });
}
auto out_ptr = reinterpret_cast<int32_t *>(getChildEdgesAtPort(NMS_SELECTED_INDICES)[0]->getMemoryPtr()->getData()); auto out_ptr = reinterpret_cast<int32_t *>(getChildEdgesAtPort(NMS_SELECTED_INDICES)[0]->getMemoryPtr()->getData());
int32_t* boxes_ptr = &(m_filtered_boxes[0].batch_index); int32_t* boxes_ptr = &(m_filtered_boxes[0].batch_index);
@ -308,12 +308,6 @@ void NonMaxSuppression::execute(dnnl::stream strm) {
} }
if (m_defined_outputs[NMS_SELECTED_SCORES]) { if (m_defined_outputs[NMS_SELECTED_SCORES]) {
const size_t stride = 3lu;
if (!m_out_static_shape) {
redefineOutputMemory(NMS_SELECTED_SCORES, { valid_outputs, stride });
}
auto out_ptr = reinterpret_cast<float *>(getChildEdgesAtPort(NMS_SELECTED_SCORES)[0]->getMemoryPtr()->getData()); auto out_ptr = reinterpret_cast<float *>(getChildEdgesAtPort(NMS_SELECTED_SCORES)[0]->getMemoryPtr()->getData());
size_t idx = 0lu; size_t idx = 0lu;