Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
f6d086d7
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f6d086d7
编写于
8月 18, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 18, 2020
浏览文件
操作
浏览文件
下载
差异文件
!4605 fix coding specification according to cppcheck report
Merge pull request !4605 from gongdaguo/cppcheck
上级
3fb58fcb
8c760a44
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
55 addition
and
35 deletion
+55
-35
mindspore/lite/c_ops/power.cc
mindspore/lite/c_ops/power.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/base/matmul_base.cc
mindspore/lite/src/runtime/kernel/arm/base/matmul_base.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc
.../src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc
+7
-0
mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd.cc
.../lite/src/runtime/kernel/arm/fp32/convolution_winograd.cc
+5
-0
mindspore/lite/src/runtime/kernel/arm/int8/squeeze_int8.cc
mindspore/lite/src/runtime/kernel/arm/int8/squeeze_int8.cc
+1
-0
mindspore/lite/src/runtime/kernel/arm/nnacl/common_func.c
mindspore/lite/src/runtime/kernel/arm/nnacl/common_func.c
+1
-1
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/conv_fp16.c
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/conv_fp16.c
+9
-9
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/deconv_fp16.c
...pore/lite/src/runtime/kernel/arm/nnacl/fp16/deconv_fp16.c
+3
-0
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/pack_fp16.c
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/pack_fp16.c
+2
-2
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/winograd_transform_fp16.c
...c/runtime/kernel/arm/nnacl/fp16/winograd_transform_fp16.c
+1
-1
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/winograd_utils_fp16.c
...e/src/runtime/kernel/arm/nnacl/fp16/winograd_utils_fp16.c
+1
-1
mindspore/lite/src/runtime/kernel/arm/nnacl/fp32/conv.c
mindspore/lite/src/runtime/kernel/arm/nnacl/fp32/conv.c
+1
-1
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/arg_min_max_int8.c
...lite/src/runtime/kernel/arm/nnacl/int8/arg_min_max_int8.c
+4
-4
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/arithmetic_int8.c
.../lite/src/runtime/kernel/arm/nnacl/int8/arithmetic_int8.c
+6
-6
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/conv_int8.c
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/conv_int8.c
+1
-1
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/reduce_int8.c
...pore/lite/src/runtime/kernel/arm/nnacl/int8/reduce_int8.c
+1
-1
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/resize.c
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/resize.c
+2
-2
mindspore/lite/src/runtime/kernel/arm/nnacl/quantization/fixed_point.c
...e/src/runtime/kernel/arm/nnacl/quantization/fixed_point.c
+2
-2
mindspore/lite/src/runtime/kernel/arm/nnacl/winograd_transform.c
...re/lite/src/runtime/kernel/arm/nnacl/winograd_transform.c
+1
-1
mindspore/lite/src/runtime/kernel/arm/nnacl/winograd_utils.c
mindspore/lite/src/runtime/kernel/arm/nnacl/winograd_utils.c
+1
-1
mindspore/lite/src/runtime/kernel/opencl/cl/fp32/arithmetic_image2d.cl
...e/src/runtime/kernel/opencl/cl/fp32/arithmetic_image2d.cl
+3
-0
mindspore/lite/tools/converter/quantizer/aware_quantizer.cc
mindspore/lite/tools/converter/quantizer/aware_quantizer.cc
+1
-0
未找到文件。
mindspore/lite/c_ops/power.cc
浏览文件 @
f6d086d7
...
...
@@ -47,7 +47,7 @@ int Power::InferShape(std::vector<lite::tensor::Tensor *> inputs, std::vector<li
}
auto
output_tensor
=
outputs
[
0
];
MS_ASSERT
(
output_tensor
!=
nullptr
);
if
(
exp_tensor
)
{
if
(
exp_tensor
!=
nullptr
)
{
if
(
exp_tensor
->
shape
()
!=
x_tensor
->
shape
()
||
exp_tensor
->
data_type
()
!=
x_tensor
->
data_type
())
{
MS_LOG
(
ERROR
)
<<
"Power inputs shape or type is not equal!"
;
return
1
;
...
...
mindspore/lite/src/runtime/kernel/arm/base/matmul_base.cc
浏览文件 @
f6d086d7
...
...
@@ -39,7 +39,7 @@ kernel::LiteKernel *CpuMatmulKernelCreator(const std::vector<lite::tensor::Tenso
case
kNumberTypeInt8
:
case
kNumberTypeUInt8
:
{
kernel
=
new
(
std
::
nothrow
)
MatmulInt8CPUKernel
(
opParameter
,
inputs
,
outputs
,
ctx
,
primitive
);
if
(
!
kernel
)
{
if
(
kernel
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"kernel is nullptr."
;
return
nullptr
;
}
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc
浏览文件 @
f6d086d7
...
...
@@ -65,6 +65,13 @@ void WinogradFilterTransformFp16(const float16_t *weight_data, Matrix *trans_wei
int
kernel_plane_stride
=
channel_in
;
if
(
oc_block
==
0
)
{
MS_LOG
(
ERROR
)
<<
"Divide by zero"
;
free
(
tmp_weight_data
);
free
(
tmp_data
);
free
(
trans_out_data
);
free
(
matrix_g_data_fp16
);
free
(
matrix_gt_data_fp16
);
delete
matrix_g
;
delete
matrix_gt
;
return
;
}
for
(
int
i
=
0
;
i
<
channel_out
;
i
++
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd.cc
浏览文件 @
f6d086d7
...
...
@@ -54,6 +54,11 @@ void WinogradFilterTransform(const float *weight_data, Matrix *trans_weight, int
int
kernel_plane_stride
=
channel_in
;
if
(
oc_block
==
0
)
{
MS_LOG
(
ERROR
)
<<
"Divide by zero"
;
free
(
tmp_weight_data
);
free
(
tmp_data
);
free
(
trans_out_data
);
delete
matrix_g
;
delete
matrix_gt
;
return
;
}
for
(
int
i
=
0
;
i
<
channel_out
;
i
++
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/int8/squeeze_int8.cc
浏览文件 @
f6d086d7
...
...
@@ -161,6 +161,7 @@ int SqueezeInt8CPUKernel::Run() {
if
(
ret
!=
RET_OK
)
{
MS_LOG
(
ERROR
)
<<
"RunSqueezeParam failed. errorcode: "
;
}
free
(
inputs_array
);
return
ret
;
}
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/common_func.c
浏览文件 @
f6d086d7
...
...
@@ -219,7 +219,7 @@ void IndirectGemmFp32_Comm(float *output, const float *input, const float *weigh
int
d4mod
=
deep
%
4
;
int
d4div
=
deep
/
4
;
int
a_index
=
d4div
*
4
*
8
+
r
*
4
+
d4mod
;
int
b_index
=
8
*
deep
+
c
;
const
int
b_index
=
8
*
deep
+
c
;
value
+=
input
[
a_index
]
*
weight
[
b_index
];
}
output
[
r
*
offset
+
c
]
=
value
;
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/conv_fp16.c
浏览文件 @
f6d086d7
...
...
@@ -334,7 +334,7 @@ void ConvFp16(float16_t *input_data, float16_t *packed_input, float16_t *packed_
bool
relu6
=
conv_param
->
is_relu6_
;
// todo
int
thread_count
=
conv_param
->
thread_num_
;
int
tile_n
=
16
;
const
int
tile_n
=
16
;
int
output_count
=
out_h
*
out_w
;
int
output_tile_count
=
UP_DIV
(
output_count
,
tile_n
);
...
...
@@ -379,7 +379,7 @@ void Conv3x3Fp16(float16_t *input_data, float16_t *transed_weight, const float16
float16_t
*
tile_buffer
,
float16_t
*
block_unit_buffer
,
float16_t
*
tmp_dst_buffer
,
float16_t
*
tmp_out
,
int
task_id
,
ConvParameter
*
conv_param
)
{
int
thread_count
=
conv_param
->
thread_num_
;
int
tile_num
=
16
;
const
int
tile_num
=
16
;
const
int
output_unit
=
4
;
const
int
k_plane
=
36
;
int
ic4
=
UP_DIV
(
conv_param
->
input_channel_
,
C4NUM
);
...
...
@@ -427,7 +427,7 @@ void UnPack3x3OutputFp16(const float16_t *src, float16_t *dst, int batch, int he
float16_t
*
batch_out
=
dst
+
ro_batch_size
;
for
(
int
h
=
0
;
h
<
height
;
h
++
)
{
int
src_h_offset
=
h
*
out_w_block
*
C4NUM
*
C8NUM
;
int
dst_h_offset
=
h
*
width
*
channel
;
const
int
dst_h_offset
=
h
*
width
*
channel
;
for
(
int
w
=
0
;
w
<
width
;
w
++
)
{
int
src_w_offset
=
src_h_offset
+
w
*
C8NUM
;
int
dst_w_offset
=
dst_h_offset
+
w
*
channel
;
...
...
@@ -462,7 +462,7 @@ void UnPack3x3ReluOutputFp16(const float16_t *src, float16_t *dst, int batch, in
float16_t
*
batch_out
=
dst
+
ro_batch_size
;
for
(
int
h
=
0
;
h
<
height
;
h
++
)
{
int
src_h_offset
=
h
*
out_w_block
*
C4NUM
*
C8NUM
;
int
dst_h_offset
=
h
*
width
*
channel
;
const
int
dst_h_offset
=
h
*
width
*
channel
;
for
(
int
w
=
0
;
w
<
width
;
w
++
)
{
int
src_w_offset
=
src_h_offset
+
w
*
C8NUM
;
int
dst_w_offset
=
dst_h_offset
+
w
*
channel
;
...
...
@@ -502,7 +502,7 @@ void UnPack3x3Relu6OutputFp16(const float16_t *src, float16_t *dst, int batch, i
float16_t
*
batch_out
=
dst
+
ro_batch_size
;
for
(
int
h
=
0
;
h
<
height
;
h
++
)
{
int
src_h_offset
=
h
*
out_w_block
*
C4NUM
*
C8NUM
;
int
dst_h_offset
=
h
*
width
*
channel
;
const
int
dst_h_offset
=
h
*
width
*
channel
;
for
(
int
w
=
0
;
w
<
width
;
w
++
)
{
int
src_w_offset
=
src_h_offset
+
w
*
C8NUM
;
int
dst_w_offset
=
dst_h_offset
+
w
*
channel
;
...
...
@@ -545,7 +545,7 @@ void ConvWinogardFp16(float16_t *input_data, float16_t *trans_weight, const floa
int
out_unit
=
conv_param
->
output_unit_
;
int
out_w_block
=
UP_DIV
(
conv_param
->
output_w_
,
out_unit
);
int
out_h_block
=
UP_DIV
(
conv_param
->
output_h_
,
out_unit
);
int
tile_num
=
16
;
const
int
tile_num
=
16
;
int
output_count
=
out_w_block
*
out_h_block
;
int
output_tile_count
=
UP_DIV
(
output_count
,
tile_num
);
int
out_channel
=
conv_param
->
output_channel_
;
...
...
@@ -594,7 +594,7 @@ void UnPackWinogradOutputFp16(const float16_t *src, float16_t *dst, int batch, i
int
dst_batch_offset
=
b
*
height
*
width
*
channel
;
for
(
int
h
=
0
;
h
<
height
;
h
++
)
{
int
src_h_offset
=
src_batch_offset
+
C8NUM
*
(
h
*
out_w_block_num
*
output_unit
);
int
dst_h_offset
=
dst_batch_offset
+
h
*
width
*
channel
;
const
int
dst_h_offset
=
dst_batch_offset
+
h
*
width
*
channel
;
for
(
int
w
=
0
;
w
<
width
;
w
++
)
{
int
src_w_offset
=
src_h_offset
+
w
*
C8NUM
;
int
dst_w_offset
=
dst_h_offset
+
w
*
channel
;
...
...
@@ -633,7 +633,7 @@ void UnPackWinogradReluOutputFp16(const float16_t *src, float16_t *dst, int batc
int
dst_batch_offset
=
b
*
height
*
width
*
channel
;
for
(
int
h
=
0
;
h
<
height
;
h
++
)
{
int
src_h_offset
=
src_batch_offset
+
C8NUM
*
(
h
*
out_w_block_num
*
output_unit
);
int
dst_h_offset
=
dst_batch_offset
+
h
*
width
*
channel
;
const
int
dst_h_offset
=
dst_batch_offset
+
h
*
width
*
channel
;
for
(
int
w
=
0
;
w
<
width
;
w
++
)
{
int
src_w_offset
=
src_h_offset
+
w
*
C8NUM
;
int
dst_w_offset
=
dst_h_offset
+
w
*
channel
;
...
...
@@ -679,7 +679,7 @@ void UnPackWinogradRelu6OutputFp16(const float16_t *src, float16_t *dst, int bat
int
dst_batch_offset
=
b
*
height
*
width
*
channel
;
for
(
int
h
=
0
;
h
<
height
;
h
++
)
{
int
src_h_offset
=
src_batch_offset
+
C8NUM
*
(
h
*
out_w_block_num
*
output_unit
);
int
dst_h_offset
=
dst_batch_offset
+
h
*
width
*
channel
;
const
int
dst_h_offset
=
dst_batch_offset
+
h
*
width
*
channel
;
for
(
int
w
=
0
;
w
<
width
;
w
++
)
{
int
src_w_offset
=
src_h_offset
+
w
*
C8NUM
;
int
dst_w_offset
=
dst_h_offset
+
w
*
channel
;
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/deconv_fp16.c
浏览文件 @
f6d086d7
...
...
@@ -18,6 +18,9 @@
void
PostConvFuncCommFp16
(
float16_t
*
out_ptr
,
const
float16_t
*
src_ptr_
,
const
float16_t
*
bias_ptr
,
size_t
output_channel
,
size_t
plane_size
,
size_t
stride
,
bool
is_relu
,
bool
is_relu6
,
int
size
)
{
if
(
size
==
0
)
{
return
;
}
for
(
int
oc
=
0
;
oc
<
output_channel
;
oc
++
)
{
int
oc_div
=
oc
/
size
,
oc_mod
=
oc
%
size
;
for
(
int
hw
=
0
;
hw
<
plane_size
;
hw
++
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/pack_fp16.c
浏览文件 @
f6d086d7
...
...
@@ -93,8 +93,8 @@ void Im2ColPackUnitFp16(float16_t *input_data, ConvParameter *conv_param, float1
void
PackWeightFp16
(
float16_t
*
weight_data
,
ConvParameter
*
conv_param
,
float16_t
*
packed_weight
)
{
// original weight format : ohwi
int
tile_num
=
8
;
int
inchannel_block
=
4
;
const
int
tile_num
=
8
;
const
int
inchannel_block
=
4
;
int
kernel_h
=
conv_param
->
kernel_h_
;
int
kernel_w
=
conv_param
->
kernel_w_
;
int
in_channel
=
conv_param
->
input_channel_
;
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/winograd_transform_fp16.c
浏览文件 @
f6d086d7
...
...
@@ -539,7 +539,7 @@ void Conv3x3Fp16OutputTransform(const float16_t *gemm_out, float16_t *out_data,
void
WinogradInputTransformFp16
(
const
float16_t
*
input_data
,
float16_t
*
trans_input
,
float16_t
*
tmp_data
,
int
cal_num
,
int
out_tile_index
,
int
out_w_block_num
,
ConvParameter
*
conv_param
,
InputTransformUnitFp16Func
input_trans_func
)
{
int
tile_num
=
16
;
const
int
tile_num
=
16
;
int
input_unit
=
conv_param
->
input_unit_
;
int
output_unit
=
conv_param
->
output_unit_
;
int
in_channel
=
conv_param
->
input_channel_
;
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/fp16/winograd_utils_fp16.c
浏览文件 @
f6d086d7
...
...
@@ -160,7 +160,7 @@ void InputTransform4x4UnitFp16(const float16_t *src_data, float16_t *dst_data, i
float16_t
m23
=
t23
-
0
.
25
f
*
t21
;
float16_t
m30
=
t30
-
4
*
t32
;
float16_t
m31
=
t31
+
2
*
t32
;
const
float16_t
m31
=
t31
+
2
*
t32
;
float16_t
m32
=
2
*
t32
-
t31
;
float16_t
m33
=
t33
-
0
.
25
f
*
t31
;
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/fp32/conv.c
浏览文件 @
f6d086d7
...
...
@@ -437,7 +437,7 @@ void Conv3x3Fp32(float *input_data, float *transed_weight, const float *bias_dat
int
out_h_block
=
UP_DIV
(
conv_param
->
output_h_
,
OUPUT_UNIT
);
int
output_count
=
out_w_block
*
out_h_block
;
int
output_tile_count
=
UP_DIV
(
output_count
,
TILE_NUM
);
int
input_unit_square
=
4
*
4
;
const
int
input_unit_square
=
4
*
4
;
float
*
tile_buffer
=
buffer_list
[
0
];
float
*
block_unit_buffer
=
buffer_list
[
1
];
float
*
tmp_dst_buffer
=
buffer_list
[
2
];
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/arg_min_max_int8.c
浏览文件 @
f6d086d7
...
...
@@ -91,7 +91,7 @@ int8_t GetInt8Output(float real_out, float output_inverse_scale, int32_t output_
void
Int8ArgMinMaxDim0
(
const
int8_t
*
input
,
int8_t
*
output
,
const
int
*
in_shape
,
ArgMinMaxParameter
*
param
,
QuantArg
*
in_quant_arg
,
QuantArg
*
out_quant_arg
)
{
bool
out_value
=
param
->
out_value_
;
float
output_inverse_scale
=
1
.
f
/
out_quant_arg
->
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
out_quant_arg
->
scale_
;
float
bias
=
-
in_quant_arg
->
zp_
*
in_quant_arg
->
scale_
;
int32_t
output_zp
=
out_quant_arg
->
zp_
;
for
(
int32_t
i
=
0
;
i
<
param
->
in_strides_
[
0
];
++
i
)
{
...
...
@@ -117,7 +117,7 @@ void Int8ArgMinMaxDim0(const int8_t *input, int8_t *output, const int *in_shape,
void
Int8ArgMinMaxDim1
(
const
int8_t
*
input
,
int8_t
*
output
,
const
int
*
in_shape
,
ArgMinMaxParameter
*
param
,
QuantArg
*
in_quant_arg
,
QuantArg
*
out_quant_arg
)
{
bool
out_value
=
param
->
out_value_
;
float
output_inverse_scale
=
1
.
f
/
out_quant_arg
->
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
out_quant_arg
->
scale_
;
float
bias
=
-
in_quant_arg
->
zp_
*
in_quant_arg
->
scale_
;
int32_t
output_zp
=
out_quant_arg
->
zp_
;
int
in_shape1
=
in_shape
[
1
];
...
...
@@ -148,7 +148,7 @@ void Int8ArgMinMaxDim1(const int8_t *input, int8_t *output, const int *in_shape,
void
Int8ArgMinMaxDim2
(
const
int8_t
*
input
,
int8_t
*
output
,
const
int
*
in_shape
,
ArgMinMaxParameter
*
param
,
QuantArg
*
in_quant_arg
,
QuantArg
*
out_quant_arg
)
{
bool
out_value
=
param
->
out_value_
;
float
output_inverse_scale
=
1
.
f
/
out_quant_arg
->
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
out_quant_arg
->
scale_
;
float
bias
=
-
in_quant_arg
->
zp_
*
in_quant_arg
->
scale_
;
int32_t
output_zp
=
out_quant_arg
->
zp_
;
int
in_shape1
=
in_shape
[
1
];
...
...
@@ -183,7 +183,7 @@ void Int8ArgMinMaxDim2(const int8_t *input, int8_t *output, const int *in_shape,
void
Int8ArgMinMaxDim3
(
const
int8_t
*
input
,
int8_t
*
output
,
const
int
*
in_shape
,
ArgMinMaxParameter
*
param
,
QuantArg
*
in_quant_arg
,
QuantArg
*
out_quant_arg
)
{
bool
out_value
=
param
->
out_value_
;
float
output_inverse_scale
=
1
.
f
/
out_quant_arg
->
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
out_quant_arg
->
scale_
;
float
bias
=
-
in_quant_arg
->
zp_
*
in_quant_arg
->
scale_
;
int32_t
output_zp
=
out_quant_arg
->
zp_
;
int
in_shape1
=
in_shape
[
1
];
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/arithmetic_int8.c
浏览文件 @
f6d086d7
...
...
@@ -26,7 +26,7 @@ int ElementNotEqualInt8(int8_t *input0, int8_t *input1, int8_t *output, int elem
ArithmeticQuantArg
*
quant_arg
)
{
float
in0_bias
=
-
quant_arg
->
in0_args_
.
zp_
*
quant_arg
->
in0_args_
.
scale_
;
float
in1_bias
=
-
quant_arg
->
in1_args_
.
zp_
*
quant_arg
->
in1_args_
.
scale_
;
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
float
out_zp
=
quant_arg
->
out_args_
.
zp_
;
for
(
int
index
=
0
;
index
<
element_size
;
++
index
)
{
...
...
@@ -45,7 +45,7 @@ int ElementNotEqualInt8(int8_t *input0, int8_t *input1, int8_t *output, int elem
int
ElementEqualInt8
(
int8_t
*
input0
,
int8_t
*
input1
,
int8_t
*
output
,
int
element_size
,
ArithmeticQuantArg
*
quant_arg
)
{
float
in0_bias
=
-
quant_arg
->
in0_args_
.
zp_
*
quant_arg
->
in0_args_
.
scale_
;
float
in1_bias
=
-
quant_arg
->
in1_args_
.
zp_
*
quant_arg
->
in1_args_
.
scale_
;
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
float
out_zp
=
quant_arg
->
out_args_
.
zp_
;
for
(
int
index
=
0
;
index
<
element_size
;
++
index
)
{
float
in0_real
=
input0
[
index
]
*
quant_arg
->
in0_args_
.
scale_
+
in0_bias
;
...
...
@@ -63,7 +63,7 @@ int ElementEqualInt8(int8_t *input0, int8_t *input1, int8_t *output, int element
int
ElementLessInt8
(
int8_t
*
input0
,
int8_t
*
input1
,
int8_t
*
output
,
int
element_size
,
ArithmeticQuantArg
*
quant_arg
)
{
float
in0_bias
=
-
quant_arg
->
in0_args_
.
zp_
*
quant_arg
->
in0_args_
.
scale_
;
float
in1_bias
=
-
quant_arg
->
in1_args_
.
zp_
*
quant_arg
->
in1_args_
.
scale_
;
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
float
out_zp
=
quant_arg
->
out_args_
.
zp_
;
for
(
int
index
=
0
;
index
<
element_size
;
++
index
)
{
float
in0_real
=
input0
[
index
]
*
quant_arg
->
in0_args_
.
scale_
+
in0_bias
;
...
...
@@ -78,7 +78,7 @@ int ElementLessEqualInt8(int8_t *input0, int8_t *input1, int8_t *output, int ele
ArithmeticQuantArg
*
quant_arg
)
{
float
in0_bias
=
-
quant_arg
->
in0_args_
.
zp_
*
quant_arg
->
in0_args_
.
scale_
;
float
in1_bias
=
-
quant_arg
->
in1_args_
.
zp_
*
quant_arg
->
in1_args_
.
scale_
;
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
float
out_zp
=
quant_arg
->
out_args_
.
zp_
;
for
(
int
index
=
0
;
index
<
element_size
;
++
index
)
{
...
...
@@ -94,7 +94,7 @@ int ElementGreaterInt8(int8_t *input0, int8_t *input1, int8_t *output, int eleme
ArithmeticQuantArg
*
quant_arg
)
{
float
in0_bias
=
-
quant_arg
->
in0_args_
.
zp_
*
quant_arg
->
in0_args_
.
scale_
;
float
in1_bias
=
-
quant_arg
->
in1_args_
.
zp_
*
quant_arg
->
in1_args_
.
scale_
;
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
float
out_zp
=
quant_arg
->
out_args_
.
zp_
;
for
(
int
index
=
0
;
index
<
element_size
;
++
index
)
{
...
...
@@ -110,7 +110,7 @@ int ElementGreaterEqualInt8(int8_t *input0, int8_t *input1, int8_t *output, int
ArithmeticQuantArg
*
quant_arg
)
{
float
in0_bias
=
-
quant_arg
->
in0_args_
.
zp_
*
quant_arg
->
in0_args_
.
scale_
;
float
in1_bias
=
-
quant_arg
->
in1_args_
.
zp_
*
quant_arg
->
in1_args_
.
scale_
;
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
const
float
output_inverse_scale
=
1
.
f
/
quant_arg
->
out_args_
.
scale_
;
float
out_zp
=
quant_arg
->
out_args_
.
zp_
;
for
(
int
index
=
0
;
index
<
element_size
;
++
index
)
{
float
in0_real
=
input0
[
index
]
*
quant_arg
->
in0_args_
.
scale_
+
in0_bias
;
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/conv_int8.c
浏览文件 @
f6d086d7
...
...
@@ -365,7 +365,7 @@ void Conv3x3Int8(int16_t *input_data, int16_t *transed_weight, const int32_t *bi
int
output_tile_count
=
UP_DIV
(
output_count
,
TILE_NUM
);
int
oc4
=
UP_DIV
(
output_channel
,
C4NUM
);
int
tile_buffer_offset
=
TILE_NUM
*
16
*
ic8
*
C8NUM
;
int
block_unit_buffer_offset
=
16
*
C8NUM
;
const
int
block_unit_buffer_offset
=
16
*
C8NUM
;
int
tmp_dst_buffer_offset
=
TILE_NUM
*
16
*
oc4
*
C4NUM
;
int
input_batch
=
conv_param
->
input_batch_
;
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/reduce_int8.c
浏览文件 @
f6d086d7
...
...
@@ -253,7 +253,7 @@ int ReduceMinLastAxis(const int outer_size, const int inner_size, const int axis
return
NNACL_NULL_PTR
;
}
int
i
,
j
,
k
;
int
base_offset
=
20
;
const
int
base_offset
=
20
;
for
(
j
=
tid
;
j
<
outer_size
;
j
+=
thread_num
)
{
const
int32_t
*
outer_src
=
src_data
+
j
*
axis_size
*
inner_size
;
int8_t
*
outer_dst
=
dst_data
+
j
*
inner_size
;
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/int8/resize.c
浏览文件 @
f6d086d7
...
...
@@ -41,7 +41,7 @@ int ResizeBilinearInt8(const int8_t *input_data, int8_t *output_data, const int
for
(
n
=
0
;
n
<
in_n
;
n
++
)
{
for
(
h
=
tid
;
h
<
new_height
;
h
+=
thread_num
)
{
// float actual_y = (float)h * height_scale;
int
base_offset
=
20
;
const
int
base_offset
=
20
;
int
scaled_actual_y
;
int
bottom
,
top
;
int
scaled_bottom_weight
,
scaled_top_weight
;
...
...
@@ -149,7 +149,7 @@ void ComputeNearestNeighborInt(const int32_t pos, const int in_size, const int32
int
ResizeNearestNeighborInt8
(
const
int8_t
*
input_data
,
int8_t
*
output_data
,
const
int
*
input_shape
,
const
int
*
output_shape
,
const
bool
align_corners
,
const
QuantMulArg
*
multiplier
,
QuantArg
*
quant_in
,
QuantArg
*
quant_out
,
int
tid
,
int
thread_num
)
{
int
base_offset
=
20
;
const
int
base_offset
=
20
;
int32_t
batch
,
y
,
x
,
c
;
int32_t
in_h
,
in_w
,
new_height
,
new_width
;
in_h
=
input_shape
[
1
];
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/quantization/fixed_point.c
浏览文件 @
f6d086d7
...
...
@@ -55,7 +55,7 @@ int MultiplyByQuantizedMultiplier(int32_t value, int32_t multiplier, int32_t lef
}
int
FractionsBits
(
int
kIntegerBits
)
{
int
totalBits
=
8
*
sizeof
(
int32_t
)
-
1
;
const
int
totalBits
=
8
*
sizeof
(
int32_t
)
-
1
;
return
totalBits
-
kIntegerBits
;
}
...
...
@@ -82,7 +82,7 @@ int32_t BitNot(int32_t a) { return ~(uint32_t)a; }
int
SelectUsingMask
(
int
mask
,
int
bound
,
int
val
)
{
return
BitXor
(
BitAnd
(
mask
,
bound
),
BitAnd
(
BitNot
(
mask
),
val
));
}
int32_t
MaskNonZero
(
int32_t
a
)
{
int32_t
zreo
=
0
;
const
int32_t
zreo
=
0
;
return
a
?
BitNot
(
zreo
)
:
zreo
;
}
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/winograd_transform.c
浏览文件 @
f6d086d7
...
...
@@ -284,7 +284,7 @@ void Conv3x3Fp32InputTransform(const float *input_data, float *trans_input, floa
int
pad_w
=
conv_param
->
pad_w_
;
int
pad_h
=
conv_param
->
pad_h_
;
int
ic4
=
UP_DIV
(
input_channel
,
C4NUM
);
int
input_unit
=
4
;
const
int
input_unit
=
4
;
if
(
out_w_block
==
0
)
{
return
;
}
...
...
mindspore/lite/src/runtime/kernel/arm/nnacl/winograd_utils.c
浏览文件 @
f6d086d7
...
...
@@ -162,7 +162,7 @@ void InputTransform4x4Unit(const float *src_data, float *dst_data, int src_step,
float
m30
=
t30
-
4
*
t32
;
float
m31
=
t31
+
2
*
t32
;
float
m32
=
2
*
t32
-
t31
;
const
float
m32
=
2
*
t32
-
t31
;
float
m33
=
t33
-
0
.
25
f
*
t31
;
(
dst_data
+
i
)[
0
]
=
m00
;
...
...
mindspore/lite/src/runtime/kernel/opencl/cl/fp32/arithmetic_image2d.cl
浏览文件 @
f6d086d7
...
...
@@ -49,6 +49,9 @@ __kernel void ElementDiv(__read_only image2d_t input_a, __read_only image2d_t in
float4 a = read_imagef(input_a, smp_none, (int2)(X, Y));
float4 b = read_imagef(input_b, smp_none, (int2)(X, Y));
if (b == 0) {
return;
}
write_imagef(output, (int2)(X, Y), a / b);
}
...
...
mindspore/lite/tools/converter/quantizer/aware_quantizer.cc
浏览文件 @
f6d086d7
...
...
@@ -510,6 +510,7 @@ STATUS AwareQuantizer::QuantConvBias(const mindspore::schema::MetaGraphT *graph,
auto
ret
=
memcpy_s
(
biasTensor
->
data
.
data
(),
bShapeSize
*
sizeof
(
int32_t
),
qDatas
,
bShapeSize
*
sizeof
(
int32_t
));
if
(
ret
!=
EOK
)
{
// MS_LOGE("memcpy_s failed: %d", ret);
delete
[]
qDatas
;
return
RET_ERROR
;
}
delete
[]
qDatas
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录