diff --git a/src/operators/batchnorm_op.cpp b/src/operators/batchnorm_op.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f87892f1eb48f1bf155b2eefb29febeb2681da81 --- /dev/null +++ b/src/operators/batchnorm_op.cpp @@ -0,0 +1,31 @@ +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +==============================================================================*/ + +#include "batchnorm_op.h" + +namespace paddle_mobile { +namespace operators { + +template +void BatchNormOp::InferShape() const { + auto x_dims = param_.InputX()->dims(); + param_.OutputY()->Resize(x_dims); +} +template class BatchNormOp; +} // namespace operators +} // namespace paddle_mobile diff --git a/src/operators/batchnorm_op.h b/src/operators/batchnorm_op.h new file mode 100644 index 0000000000000000000000000000000000000000..71e1441155443995c4301af44022fca30b7e53f4 --- /dev/null +++ b/src/operators/batchnorm_op.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +==============================================================================*/ + +#include "framework/operator.h" +#include "operators/kernel/batchnorm_kernel.h" +#include "operators/op_param.h" + +namespace paddle_mobile { +namespace operators { + +using namespace framework; + +template +class BatchNormOp : public framework::OperatorWithKernel { + public: + BatchNormOp(const std::string &type, const VariableNameMap &inputs, + const VariableNameMap &outputs, + const framework::AttributeMap attrs, + std::shared_ptr scope) + : framework::OperatorWithKernel(type, inputs, outputs, + attrs, scope), + param_(inputs, outputs, attrs, *scope) {} + + void Run() const { + operators::BatchNormKernel kernel; + kernel.Compute(param_); + } + + using framework::OperatorWithKernel::OperatorWithKernel; + void InferShape() const override; + + protected: + BatchNormParam param_; +}; + +} // namespace operators +} // namespace paddle_mobile diff --git a/src/operators/kernel/arm/batchnorm_kernel.cpp b/src/operators/kernel/arm/batchnorm_kernel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e5bc7f2afd0cc5a21be5fe5a482c69251f66f465 --- /dev/null +++ b/src/operators/kernel/arm/batchnorm_kernel.cpp @@ -0,0 +1,93 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +#pragma once + +#include "operators/kernel/batchnorm_kernel.h" + +namespace paddle_mobile { +namespace operators { + +template <> +void BatchNormKernel::Compute(const BatchNormParam ¶m) const { + /// todo: test. + const Tensor *input_x = param.InputX(); + auto input_x_ptr = input_x->data(); + const auto &x_dims = input_x->dims(); + const int N = x_dims[0]; + const int C = x_dims[1]; + const int H = x_dims[2]; + const int W = x_dims[3]; + const int stride0 = C * H * W; + const int stride1 = H * W; + const int stride2 = W; + Tensor *out = param.OutputY(); + auto out_ptr = out->mutable_data(); + const float epsilon = param.Epsilon(); + const Tensor *mean = param.InputMean(); + const Tensor *variance = param.InputVariance(); + const Tensor *scale = param.InputScale(); + const Tensor *bias = param.InputBias(); + auto mean_ptr = mean->data(); + auto variance_ptr = variance->data(); + auto scale_ptr = scale->data(); + auto bias_ptr = bias->data(); + + Tensor inv_std; + auto inv_std_ptr = inv_std.mutable_data(make_ddim({C})); + if (C != variance->numel()) { + std::cout << "C must equal to variance.numel()" << std::endl; + } + assert(C == variance->numel()); + + /// std = (var + epsilon).sqrt(); + /// inv_std = 1 / std; + for (int i = 0; i < C; i++) { + inv_std_ptr[i] = + 1 / static_cast(pow((variance_ptr[i] + epsilon), 0.5)); + } + + Tensor new_scale; + auto new_scale_ptr = new_scale.mutable_data(make_ddim({C})); + Tensor new_bias; + auto new_bias_ptr = new_bias.mutable_data(make_ddim({C})); + + /// ((x - est_mean) * (inv_var) * scale + bias equal to + /// (x * inv_var * scale) + (bias - est_mean * inv_var * scale) + for (int i = 0; i < C; i++) { + new_scale_ptr[i] = inv_std_ptr[i] * scale_ptr[i]; + new_bias_ptr[i] = + bias_ptr[i] - mean_ptr[i] * inv_std_ptr[i] * scale_ptr[i]; + { + for (int n = 0; n < N; n++) { + for (int h = 0; h < H; h++) { + for (int w = 0; w < W; w++) { + int index = n * stride0 + i * stride1 + h * stride2 + w; + out_ptr[index] = input_x_ptr[index] * new_scale_ptr[i] + + new_bias_ptr[i]; + } + } + } + } + } + DLOG << "input[2,5,1,0](input[102]) ,channel 5 :"; + DLOG << "input_x_ptr : " << input_x_ptr[102]; + DLOG << "variance : " << variance_ptr[5]; + DLOG << "inv_std_ptr : " << inv_std_ptr[5]; + DLOG << "new_scale_ptr : " << new_scale_ptr[5]; + DLOG << "new_bias_ptr : " << new_bias_ptr[5]; + DLOG << "out_ptr : " << out_ptr[102]; +} +} // namespace operators +} // namespace paddle_mobile diff --git a/src/operators/kernel/batchnorm_kernel.h b/src/operators/kernel/batchnorm_kernel.h new file mode 100644 index 0000000000000000000000000000000000000000..f4518d0c6159d39b134f9fe2c70a215c61ea7d68 --- /dev/null +++ b/src/operators/kernel/batchnorm_kernel.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +==============================================================================*/ + +#include "framework/operator.h" +#include "operators/op_param.h" +#pragma once; + +namespace paddle_mobile { +namespace operators { + +using namespace framework; + +template +class BatchNormKernel + : public framework::OpKernelBase { + public: + void Compute(const BatchNormParam ¶m) const; +}; + +} // namespace operators +} // namespace paddle_mobile diff --git a/src/operators/op_param.h b/src/operators/op_param.h index a7e4a4d3442d0b2a976ed4ba35c760881819d0df..4e65d1daa3226faf90c014c922be511cd6b50bd5 100644 --- a/src/operators/op_param.h +++ b/src/operators/op_param.h @@ -48,6 +48,25 @@ class OpParam : PaddleMobileObject { return GetVarValue("Y", inputs, scope); } + template + static T *InputBiasFrom(const VariableNameMap &inputs, const Scope &scope) { + return GetVarValue("Bias", inputs, scope); + } + template + static T *InputVarianceFrom(const VariableNameMap &inputs, + const Scope &scope) { + return GetVarValue("Variance", inputs, scope); + } + template + static T *InputMeanFrom(const VariableNameMap &inputs, const Scope &scope) { + return GetVarValue("Mean", inputs, scope); + } + template + static T *InputScaleFrom(const VariableNameMap &inputs, + const Scope &scope) { + return GetVarValue("Scale", inputs, scope); + } + template static std::vector InputMultiFrom(const VariableNameMap &inputs, const Scope &scope) { @@ -64,6 +83,11 @@ class OpParam : PaddleMobileObject { return GetVarValue("Out", outputs, scope); } + template + static T *OutputYFrom(const VariableNameMap &outputs, const Scope &scope) { + return GetVarValue("Y", outputs, scope); + } + template static T *MidOutFrom(const VariableNameMap &outputs, const Scope &scope) { return GetVarValue("MidOut", outputs, scope); @@ -268,6 +292,54 @@ class LrnParam : public OpParam { float k_; std::string data_format_; }; +class BatchNormParam : OpParam { + public: + BatchNormParam(const VariableNameMap &inputs, + const VariableNameMap &outputs, + const framework::AttributeMap &attrs, + const framework::Scope &scope) { + input_x_ = InputXFrom(inputs, scope); + output_y_ = OutputYFrom(outputs, scope); + input_bias_ = InputBiasFrom(inputs, scope); + input_mean_ = InputMeanFrom(inputs, scope); + input_scale_ = InputScaleFrom(inputs, scope); + input_variance_ = InputVarianceFrom(inputs, scope); + epsilon_ = GetAttr("epsilon", attrs); + momentum_ = GetAttr("momentum", attrs); + is_test_ = GetAttr("is_test", attrs); + } + const Tensor *InputX() const { return input_x_; } + + Tensor *OutputY() const { return output_y_; } + + const Tensor *InputBias() const { return input_bias_; } + + const Tensor *InputMean() const { return input_mean_; } + + const Tensor *InputScale() const { return input_scale_; } + + const Tensor *InputVariance() const { return input_variance_; } + + const float &Epsilon() const { return epsilon_; } + + const float &Momentum() const { return momentum_; } + + const bool &IsTest() const { return is_test_; } + + const std::string &DataFormat() const { return data_format_; } + + private: + Tensor *input_x_; + Tensor *output_y_; + Tensor *input_bias_; + Tensor *input_mean_; + Tensor *input_scale_; + Tensor *input_variance_; + float epsilon_; + float momentum_; + bool is_test_; + std::string data_format_; +}; } // namespace operators } // namespace paddle_mobile diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 089a3e9c78940a47e27ad2fe8e87f619f3ef5b59..b45c0edf5557fc26d6ed5d9283dc7961371f1bc0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -19,6 +19,10 @@ target_link_libraries(test-concat-op paddle-mobile) ADD_EXECUTABLE(test-lrn-op operators/test_lrn_op.cpp test_helper.h test_include.h) target_link_libraries(test-lrn-op paddle-mobile) +# gen test +ADD_EXECUTABLE(test-batchnorm-op operators/test_batchnorm_op.cpp test_helper.h test_include.h) +target_link_libraries(test-batchnorm-op paddle-mobile) + # gen test log ADD_EXECUTABLE(test-log common/test_log.cpp) target_link_libraries(test-log paddle-mobile) diff --git a/test/operators/test_batchnorm_op.cpp b/test/operators/test_batchnorm_op.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ddc7a38067a2cb8bc6c0ebf6c851b049163a31b6 --- /dev/null +++ b/test/operators/test_batchnorm_op.cpp @@ -0,0 +1,176 @@ + +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +==============================================================================*/ +#pragma once +#include "../test_include.h" +#include "operators/batchnorm_op.h" + +namespace paddle_mobile { +namespace framework { + +template class TestBatchNormOp { + public: + explicit TestBatchNormOp(const Program p) : program_(p) { + if (use_optimize_) { + to_predict_program_ = program_.optimizeProgram; + } else { + to_predict_program_ = program_.originProgram; + } + + const std::vector> blocks = + to_predict_program_->Blocks(); + // DLOG << " **block size " << blocks.size(); + for (int i = 0; i < blocks.size(); ++i) { + std::shared_ptr block_desc = blocks[i]; + std::vector> ops = block_desc->Ops(); + // DLOG << " ops " << ops.size(); + for (int j = 0; j < ops.size(); ++j) { + std::shared_ptr op = ops[j]; + if (op->Type() == "batch_norm" && + op->Input("X")[0] == "conv2d_0.tmp_0") { + DLOG << " mul attr size: " << op->GetAttrMap().size(); + DLOG << " inputs size: " << op->GetInputs().size(); + DLOG << " outputs size: " << op->GetOutputs().size(); + DLOG << " Input X is : " << op->Input("X")[0]; + DLOG << " Input Mean is : " << op->Input("Mean")[0]; + DLOG << " Input Variance is : " << op->Input("Variance")[0]; + DLOG << " Input Scale is : " << op->Input("Scale")[0]; + DLOG << " Input Bias is : " << op->Input("Bias")[0]; + DLOG << " Output Y is : " << op->Output("Y")[0]; + DLOG << " epsilon : " + << op->GetAttrMap().at("epsilon").Get(); + std::shared_ptr> lrn = + std::make_shared>( + op->Type(), op->GetInputs(), op->GetOutputs(), + op->GetAttrMap(), program_.scope); + ops_of_block_[*block_desc.get()].push_back(lrn); + } + } + } + } + + std::shared_ptr predict_bn(Tensor &t1, Tensor &t2, Tensor &t3, + Tensor &t4, Tensor &t5) { + // feed + auto scope = program_.scope; + Variable *x1_feed_value = scope->Var("conv2d_0.tmp_0"); + auto tensor_x1 = x1_feed_value->GetMutable(); + tensor_x1->ShareDataWith(t1); + + Variable *mean_feed_value = scope->Var("batch_norm_0.w_1"); + auto tensor_mean = mean_feed_value->GetMutable(); + tensor_mean->ShareDataWith(t2); + + Variable *scale_feed_value = scope->Var("batch_norm_0.w_0"); + auto tensor_scale = scale_feed_value->GetMutable(); + tensor_scale->ShareDataWith(t3); + + Variable *variance_feed_value = scope->Var("batch_norm_0.w_2"); + auto tensor_variance = variance_feed_value->GetMutable(); + tensor_variance->ShareDataWith(t4); + + Variable *bias_feed_value = scope->Var("batch_norm_0.b_0"); + auto tensor_bias = bias_feed_value->GetMutable(); + tensor_bias->ShareDataWith(t5); + + Variable *output = scope->Var("batch_norm_0.tmp_2"); + auto *output_tensor = output->GetMutable(); + output_tensor->mutable_data({4, 10, 2, 2}); + // DLOG << typeid(output_tensor).name(); + // DLOG << "output_tensor dims: " << output_tensor->dims(); + + std::shared_ptr out_tensor = std::make_shared(); + out_tensor.reset(output_tensor); + + predict_bn(t1, t2, t3, t4, t5, 0); + return out_tensor; + } + + private: + const framework::Program program_; + std::shared_ptr to_predict_program_; + std::map>>> + ops_of_block_; + bool use_optimize_ = false; + + void predict_bn(const Tensor &t1, const Tensor &t2, const Tensor &t3, + const Tensor &t4, const Tensor &t5, int block_id) { + std::shared_ptr to_predict_block = + to_predict_program_->Block(block_id); + for (int j = 0; j < ops_of_block_[*to_predict_block.get()].size(); + ++j) { + auto op = ops_of_block_[*to_predict_block.get()][j]; + DLOG << "op -> run()"; + op->Run(); + } + } +}; + +template class TestBatchNormOp; +} // namespace framework +} // namespace paddle_mobile + +int main() { + DLOG << "----------**********----------"; + DLOG << "begin to run BatchNormOp Test"; + paddle_mobile::Loader loader; + auto program = loader.Load(std::string( + "../../test/models/image_classification_resnet.inference.model")); + + /// input x (4,10,2,2) + paddle_mobile::framework::Tensor inputx1; + SetupTensor(&inputx1, {4, 10, 2, 2}, static_cast(0), + static_cast(1)); + auto *inputx1_ptr = inputx1.data(); + + paddle_mobile::framework::Tensor mean; + SetupTensor(&mean, {10}, static_cast(0), + static_cast(1)); + auto *mean_ptr = mean.data(); + + paddle_mobile::framework::Tensor scale; + SetupTensor(&scale, {10}, static_cast(0), + static_cast(1)); + auto *scale_ptr = scale.data(); + + paddle_mobile::framework::Tensor variance; + SetupTensor(&variance, {10}, static_cast(0), + static_cast(1)); + auto *variance_ptr = variance.data(); + + paddle_mobile::framework::Tensor bias; + SetupTensor(&bias, {10}, static_cast(0), + static_cast(1)); + auto *bias_ptr = bias.data(); + + paddle_mobile::framework::TestBatchNormOp + testBatchNormOp(program); + + auto output_bn = + testBatchNormOp.predict_bn(inputx1, mean, scale, variance, bias); + auto *output_bn_ptr = output_bn->data(); + + /// [2, 5, 1, 0] + DLOG << " (" << inputx1_ptr[102] << " - " << mean_ptr[5] << ")/((" + << variance_ptr[5] << " + 0.00001" + << ")^0.5)* " << scale_ptr[5] << " + " << bias_ptr[5] << " = "; + DLOG << output_bn_ptr[102]; + + return 0; +} diff --git a/test/operators/test_concat_op.cpp b/test/operators/test_concat_op.cpp index 625a836902aa95e92213da50775b231337f61081..d3c97a5e84c950dbeba698c871162a1088a97219 100644 --- a/test/operators/test_concat_op.cpp +++ b/test/operators/test_concat_op.cpp @@ -41,21 +41,6 @@ template class TestConcatOp { // DLOG << " ops " << ops.size(); for (int j = 0; j < ops.size(); ++j) { std::shared_ptr op = ops[j]; - // if (op->Type() == "mul") { - // DLOG << "x_num_col_dims : - // " - // << op->GetAttrMap() - // .at("x_num_col_dims") - // .Get(); - // DLOG << "y_num_col_dims : - // " - // << op->GetAttrMap() - // .at("y_num_col_dims") - // .Get(); - // DLOG << " Input X is : " - // << op->Input("X")[0]; - // } - // DLOG << "op:" << op->Type(); if (op->Type() == "concat" && op->Input("X")[0] == "conv2d_3.tmp_1") { DLOG << " mul attr size: " << op->GetAttrMap().size(); diff --git a/test/operators/test_elementwise_add_op.cpp b/test/operators/test_elementwise_add_op.cpp index be1f0705dfd3656ed5b1328e4162bf0a1cee91f6..081a3fe0d00abfb6bba927f1f15f3a5a0bf402b6 100644 --- a/test/operators/test_elementwise_add_op.cpp +++ b/test/operators/test_elementwise_add_op.cpp @@ -41,18 +41,6 @@ template class TestElementwiseAddOp { // DLOG << " ops " << ops.size(); for (int j = 0; j < ops.size(); ++j) { std::shared_ptr op = ops[j]; - // if (op->Type() == - // "elementwise_add") { - // if - // (op->GetAttrMap().at("axis").Get() - // != -1) { - // DLOG << "attr: axis = - // " - // << - // op->GetAttrMap().at("axis").Get(); - // } - // } - // DLOG << "op:" << op->Type(); if (op->Type() == "elementwise_add" && op->Input("X")[0] == "batch_norm_2.tmp_2") { DLOG << " elementwise_add attr size: " diff --git a/test/operators/test_lrn_op.cpp b/test/operators/test_lrn_op.cpp index 76ed3fc25a8385156e8e3197e25a5092e9f075ac..2ff06e1390bcb09296d56ac57aed6360ac788ad0 100644 --- a/test/operators/test_lrn_op.cpp +++ b/test/operators/test_lrn_op.cpp @@ -41,21 +41,6 @@ template class TestLrnOp { // DLOG << " ops " << ops.size(); for (int j = 0; j < ops.size(); ++j) { std::shared_ptr op = ops[j]; - // if (op->Type() == "mul") { - // DLOG << "x_num_col_dims : - // " - // << op->GetAttrMap() - // .at("x_num_col_dims") - // .Get(); - // DLOG << "y_num_col_dims : - // " - // << op->GetAttrMap() - // .at("y_num_col_dims") - // .Get(); - // DLOG << " Input X is : " - // << op->Input("X")[0]; - // } - // DLOG << "op:" << op->Type(); if (op->Type() == "lrn" && op->Input("X")[0] == "pool2d_0.tmp_0") { DLOG << " mul attr size: " << op->GetAttrMap().size(); diff --git a/test/operators/test_mul_op.cpp b/test/operators/test_mul_op.cpp index 18375da8d2221c163b4e13d6e6dcfbf884f598d4..a6aab354834ae52398f5cdabd5a6e23d11709dc0 100644 --- a/test/operators/test_mul_op.cpp +++ b/test/operators/test_mul_op.cpp @@ -41,21 +41,6 @@ template class TestMulOp { // DLOG << " ops " << ops.size(); for (int j = 0; j < ops.size(); ++j) { std::shared_ptr op = ops[j]; - // if (op->Type() == "mul") { - // DLOG << "x_num_col_dims : - // " - // << op->GetAttrMap() - // .at("x_num_col_dims") - // .Get(); - // DLOG << "y_num_col_dims : - // " - // << op->GetAttrMap() - // .at("y_num_col_dims") - // .Get(); - // DLOG << " Input X is : " - // << op->Input("X")[0]; - // } - // DLOG << "op:" << op->Type(); if (op->Type() == "mul" && op->Input("X")[0] == "pool2d_0.tmp_0") { DLOG << " mul attr size: " << op->GetAttrMap().size();