Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite2d76a6

Browse files
author
Alexander Lyulkov
committed
Added DNN_TARGET_CPU_FP16 to type inference(fixed3)
1 parenta555121 commite2d76a6

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

‎modules/dnn/perf/perf_convolution.cpp‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,12 +887,17 @@ Net build_net(
887887

888888
MatShape netInputShape =shape(input);
889889
cv::dnn::MatType netInputType = input.depth();
890+
891+
bool fp16 =false;
890892
#ifdef HAVE_OPENCL
891-
bool fp16 =ocl::Device::getDefault().isExtensionSupported("cl_khr_fp16");
893+
fp16 =ocl::Device::getDefault().isExtensionSupported("cl_khr_fp16");
894+
#endif
895+
#if defined(__arm64__) && __arm64__
896+
fp16 =true;
897+
#endif
892898
if (netInputType == CV_32F && fp16
893899
&& (targetId == DNN_TARGET_OPENCL_FP16 || targetId == DNN_TARGET_CPU_FP16))
894900
netInputType = CV_16F;
895-
#endif
896901
size_t weightsMemory =0, blobsMemory =0;
897902
net.getMemoryConsumption(netInputShape, netInputType, weightsMemory, blobsMemory);
898903
int64 flops = net.getFLOPS(netInputShape, netInputType);

‎modules/dnn/perf/perf_convolution1d.cpp‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,17 @@ PERF_TEST_P_(Conv1D, conv1d)
137137

138138
MatShape netInputShape =shape(input);
139139
cv::dnn::MatType netInputType = input.depth();
140+
141+
bool fp16 =false;
140142
#ifdef HAVE_OPENCL
141-
bool fp16 =ocl::Device::getDefault().isExtensionSupported("cl_khr_fp16");
143+
fp16 =ocl::Device::getDefault().isExtensionSupported("cl_khr_fp16");
144+
#endif
145+
#if defined(__arm64__) && __arm64__
146+
fp16 =true;
147+
#endif
142148
if (netInputType == CV_32F && fp16
143149
&& (targetId == DNN_TARGET_OPENCL_FP16 || targetId == DNN_TARGET_CPU_FP16))
144150
netInputType = CV_16F;
145-
#endif
146151
size_t weightsMemory =0, blobsMemory =0;
147152
net.getMemoryConsumption(netInputShape, netInputType, weightsMemory, blobsMemory);
148153
int64 flops = net.getFLOPS(netInputShape, netInputType);

‎modules/dnn/perf/perf_convolution3d.cpp‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,17 @@ PERF_TEST_P_(Conv3D, conv3d)
156156

157157
MatShape netInputShape =shape(input);
158158
cv::dnn::MatType netInputType = input.depth();
159+
160+
bool fp16 =false;
159161
#ifdef HAVE_OPENCL
160-
bool fp16 =ocl::Device::getDefault().isExtensionSupported("cl_khr_fp16");
162+
fp16 =ocl::Device::getDefault().isExtensionSupported("cl_khr_fp16");
163+
#endif
164+
#if defined(__arm64__) && __arm64__
165+
fp16 =true;
166+
#endif
161167
if (netInputType == CV_32F && fp16
162168
&& (targetId == DNN_TARGET_OPENCL_FP16 || targetId == DNN_TARGET_CPU_FP16))
163169
netInputType = CV_16F;
164-
#endif
165170
size_t weightsMemory =0, blobsMemory =0;
166171
net.getMemoryConsumption(netInputShape, netInputType, weightsMemory, blobsMemory);
167172
int64 flops = net.getFLOPS(netInputShape, netInputType);

‎modules/dnn/perf/perf_net.cpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class DNNTestNetwork : public ::perf::TestBaseWithParam< tuple<Backend, Target>
5151
bool fp16 =false;
5252
#ifdef HAVE_OPENCL
5353
fp16 =ocl::Device::getDefault().isExtensionSupported("cl_khr_fp16");
54+
#endif
55+
#if defined(__arm64__) && __arm64__
56+
fp16 =true;
5457
#endif
5558
std::vector<cv::dnn::MatType> netMatTypes;
5659
for (auto& inp : inputs) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp