MCPcopy Create free account
hub / github.com/Xilinx/CHaiDNN / outputUnpack

Function outputUnpack

software/interface/xi_readwrite_util.cpp:694–746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692}
693
694int outputUnpack(void* output, std::vector<void *> output_unpack, kernel_type_e kernType, int outputSize, int en_batch_size_one)
695{
696
697 int batch_loop_cnt;
698 if(en_batch_size_one)
699 batch_loop_cnt = 1;
700 else
701 batch_loop_cnt = XBATCH_SIZE;
702
703 //# For Classification Networks
704 if(kernType == SOFTMAX)
705 {
706
707 for(int batch_id = 0; batch_id < batch_loop_cnt; batch_id++)
708 {
709 float *output_unpack_ptr = (float*)output_unpack[batch_id];
710 float *output_ptr = (float*)output;
711
712 output_ptr += batch_id;
713 for(int i=0;i<outputSize;i++)
714 {
715 output_unpack_ptr[i] = output_ptr[i*XBATCH_SIZE];
716 }
717 }
718
719 }
720
721 //# For Detection Networks
722 else if (kernType == NMS)
723 {
724 float *output_ptr = (float*)output;
725 for(int batch_id = 0; batch_id < batch_loop_cnt; batch_id++)
726 {
727 float *output_unpack_ptr = (float*)output_unpack[batch_id];
728 int BoxCount = output_ptr[0];
729 //memcpy((int*)output_unpack_ptr, &BoxCount, sizeof(int));
730 memcpy((float*)(output_unpack_ptr), (float*)(output_ptr), (BoxCount*7+1)*sizeof(float));
731 output_ptr += BoxCount*7+1;
732 }
733 }
734
735 //# For Segmentation Networks
736 else if (kernType == CROP)
737 {
738 int *output_ptr = (int*)output;
739 for(int batch_id = 0; batch_id < batch_loop_cnt; batch_id++)
740 {
741 int *output_unpack_ptr = (int*)output_unpack[batch_id];
742 memcpy((int*)output_unpack_ptr, output_ptr, outputSize*sizeof(int));
743 output_ptr += (outputSize);
744 }
745 }
746}
747
748
749//# Input Read

Callers 1

xiUnpackOutputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected