Commit 5be2964e authored by Shucai Xiao's avatar Shucai Xiao
Browse files

fixed cppcheck error

parent fc03c706
...@@ -219,7 +219,7 @@ struct cpu_quant_convolution ...@@ -219,7 +219,7 @@ struct cpu_quant_convolution
argument compute(context&, shape output_shape, std::vector<argument> args) const argument compute(context&, shape output_shape, std::vector<argument> args) const
{ {
argument result{output_shape}; argument result{output_shape};
result.visit([&](auto output) { auto output = result.get<float>();
visit_all(args[0], args[1])([&](auto input, auto weights) { visit_all(args[0], args[1])([&](auto input, auto weights) {
auto in = input.get_shape().lens(); auto in = input.get_shape().lens();
auto in_h = in[2]; auto in_h = in[2];
...@@ -236,15 +236,15 @@ struct cpu_quant_convolution ...@@ -236,15 +236,15 @@ struct cpu_quant_convolution
output_shape.lens()[2], output_shape.lens()[2],
output_shape.lens()[3])( output_shape.lens()[3])(
[&](std::size_t o, std::size_t w, std::size_t i, std::size_t j) { [&](std::size_t o, std::size_t w, std::size_t i, std::size_t j) {
const int start_x = i * op.stride[0] - op.padding[0]; const auto start_x = i * op.stride[0] - op.padding[0];
const int start_y = j * op.stride[1] - op.padding[1]; const auto start_y = j * op.stride[1] - op.padding[1];
const int group_id = w / (wei_n / op.group); const auto group_id = w / (wei_n / op.group);
float acc = 0; float acc = 0;
dfor(wei_c, wei_h, wei_w)([&](std::size_t k, std::size_t x, std::size_t y) { dfor(wei_c, wei_h, wei_w)([&](std::size_t k, std::size_t x, std::size_t y) {
const int in_x = start_x + x; const auto in_x = start_x + x;
const int in_y = start_y + y; const auto in_y = start_y + y;
const int in_ch = group_id * wei_c + k; const auto in_ch = group_id * wei_c + k;
if(in_x >= 0 && in_x < in_h && in_y >= 0 && in_y < in_w) if(in_x >= 0 && in_x < in_h && in_y >= 0 && in_y < in_w)
{ {
acc += input(o, in_ch, in_x, in_y) * weights(w, k, x, y); acc += input(o, in_ch, in_x, in_y) * weights(w, k, x, y);
...@@ -253,7 +253,6 @@ struct cpu_quant_convolution ...@@ -253,7 +253,6 @@ struct cpu_quant_convolution
output(o, w, i, j) = acc; output(o, w, i, j) = acc;
}); });
}); });
});
return result; return result;
} }
......
...@@ -32,8 +32,8 @@ struct miopen_quant_gemm ...@@ -32,8 +32,8 @@ struct miopen_quant_gemm
} }
private: private:
mutable argument arg_a; argument arg_a;
mutable argument arg_b; argument arg_b;
}; };
} // namespace gpu } // namespace gpu
......
...@@ -64,7 +64,8 @@ shape miopen_quant_gemm::compute_shape(const std::vector<shape>& inputs) const ...@@ -64,7 +64,8 @@ shape miopen_quant_gemm::compute_shape(const std::vector<shape>& inputs) const
{ {
if(arg_b.empty()) if(arg_b.empty())
{ {
arg_b = allocate_gpu(inputs[1]); auto *p_this = const_cast<miopen_quant_gemm*>(this);
p_this->arg_b = allocate_gpu(inputs[1]);
} }
} }
...@@ -72,7 +73,8 @@ shape miopen_quant_gemm::compute_shape(const std::vector<shape>& inputs) const ...@@ -72,7 +73,8 @@ shape miopen_quant_gemm::compute_shape(const std::vector<shape>& inputs) const
{ {
if(arg_a.empty()) if(arg_a.empty())
{ {
arg_a = allocate_gpu(inputs[0]); auto *p_this = const_cast<miopen_quant_gemm*>(this);
p_this->arg_a = allocate_gpu(inputs[0]);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment