From 50c5e9b0c63a547f46b677ad1e0090a953528bbc Mon Sep 17 00:00:00 2001 From: Sylwester Fraczek Date: Fri, 12 Oct 2018 14:27:32 +0200 Subject: [PATCH] reshape_2d used from ddim.h test=develop --- paddle/fluid/framework/ir/conv_bn_fuse_pass.cc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc b/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc index 86926bec64..04459612a7 100644 --- a/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc @@ -44,18 +44,6 @@ namespace ir { GET_IR_NODE_FROM_SUBGRAPH(bn_saved_mean, bn_saved_mean, pattern_name); \ GET_IR_NODE_FROM_SUBGRAPH(bn_saved_variance, bn_saved_variance, pattern_name) -// reshape to two dimensions {A, B * C * ...} -DDim make_dims_2d(DDim dims) { - auto dims_count = dims.size(); - PADDLE_ENFORCE_GT(dims_count, 0); - - int size2 = 1; - for (int i = 1; i < dims_count; i++) { - size2 *= dims[i]; - } - return make_ddim({dims[0], size2}); -} - void recompute_bias_and_weights(const Scope* scope, ir::Node* conv_weight, // const ir::Node& bn_scale, // @@ -104,7 +92,7 @@ void recompute_bias_and_weights(const Scope* scope, // Re-compute weight of conv2d from BN auto* weights = scope->FindVar(conv_weight->Name())->GetMutable(); auto weights_shape = weights->dims(); - auto weights_shape_2d = make_dims_2d(weights_shape); + auto weights_shape_2d = flatten_to_2d(weights_shape, 1); EigenMatrixArrayMap weights_array_2d( weights->mutable_data(platform::CPUPlace()), weights_shape_2d[0], -- GitLab