|
|
|
@ -284,19 +284,24 @@ int AclProcess::ModelInfer(std::map<double, double> *costTime_map) {
|
|
|
|
|
heightScale = static_cast<float>(resizeOutData->height) / inputImg->height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float im_info[4];
|
|
|
|
|
im_info[0] = static_cast<float>(inputImg->height);
|
|
|
|
|
im_info[1] = static_cast<float>(inputImg->width);
|
|
|
|
|
im_info[2] = heightScale;
|
|
|
|
|
im_info[3] = widthScale;
|
|
|
|
|
aclFloat16 inputWidth = aclFloatToFloat16(static_cast<float>(inputImg->width));
|
|
|
|
|
aclFloat16 inputHeight = aclFloatToFloat16(static_cast<float>(inputImg->height));
|
|
|
|
|
aclFloat16 resizeWidthRatioFp16 = aclFloatToFloat16(widthScale);
|
|
|
|
|
aclFloat16 resizeHeightRatioFp16 = aclFloatToFloat16(heightScale);
|
|
|
|
|
|
|
|
|
|
aclFloat16 *im_info = reinterpret_cast<aclFloat16 *>(malloc(sizeof(aclFloat16) * 4));
|
|
|
|
|
im_info[0] = inputHeight;
|
|
|
|
|
im_info[1] = inputWidth;
|
|
|
|
|
im_info[2] = resizeHeightRatioFp16;
|
|
|
|
|
im_info[3] = resizeWidthRatioFp16;
|
|
|
|
|
void *imInfo_dst = nullptr;
|
|
|
|
|
int ret = aclrtMalloc(&imInfo_dst, 16, ACL_MEM_MALLOC_NORMAL_ONLY);
|
|
|
|
|
int ret = aclrtMalloc(&imInfo_dst, 8, ACL_MEM_MALLOC_NORMAL_ONLY);
|
|
|
|
|
if (ret != ACL_ERROR_NONE) {
|
|
|
|
|
std::cout << "aclrtMalloc failed, ret = " << ret << std::endl;
|
|
|
|
|
aclrtFree(imInfo_dst);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
ret = aclrtMemcpy(reinterpret_cast<uint8_t *>(imInfo_dst), 16, im_info, 16, ACL_MEMCPY_HOST_TO_DEVICE);
|
|
|
|
|
ret = aclrtMemcpy(reinterpret_cast<uint8_t *>(imInfo_dst), 8, im_info, 8, ACL_MEMCPY_HOST_TO_DEVICE);
|
|
|
|
|
if (ret != ACL_ERROR_NONE) {
|
|
|
|
|
std::cout << "aclrtMemcpy failed, ret = " << ret << std::endl;
|
|
|
|
|
aclrtFree(imInfo_dst);
|
|
|
|
|