Closed wayen820 closed 6 years ago
There should be a reshape
operation between the following two ops to convert the 4D input to 2D to do FC usually.
bnconv_6dw7_7_batchnorm/add_1 (BiasAdd): [[1L, 512L, 1L, 1L]]
xw_plus_b/MatMul (MatMul): [[1L, 128L, 1L, 1L]]
I print some logs on the last few layers and find that may not be the reason. why the shape of bnconv_6dw7_7_batchnorm/mul_1:0 is [1, 512, 1, 512, ],it should have been [1,512,1,1]) after bnconv_6dw7_7_batchnorm/mul.Is there a mistake?
eltwise:
I tensor.h:189 Tensor conv_6dw7_7_conv2d:0 size: [1, 512, 1, 1, ]
I tensor.h:189 Tensor bnconv_6dw7_7_batchnorm/mul/_4__cf__4:0 size: [512, ]
I tensor.h:189 Tensor bnconv_6dw7_7_batchnorm/mul_1:0 size: []
W tensor.h:297 bnconv_6dw7_7_batchnorm/add_1:0: Resize buffer from size 921664 to 1048640
bias_add
I tensor.h:189 Tensor bnconv_6dw7_7_batchnorm/mul_1:0 size: [1, 512, 1, 512, ]
I tensor.h:189 Tensor bnconv_6dw7_7_batchnorm/sub/_5__cf__5:0 size: [512, ]
I tensor.h:189 Tensor bnconv_6dw7_7_batchnorm/add_1:0 size: [1, 512, 1, 512, ]
matmul:
I tensor.h:189 Tensor bnconv_6dw7_7_batchnorm/add_1:0 size: [1, 512, 1, 512, ]
I tensor.h:189 Tensor fc1_weight:0 size: [1, 1, 512, 128, ]
I tensor.h:189 Tensor xw_plus_b/MatMul:0 size: []
F matmul.h:51 Check failed: A->dim(i) == B->dim(i) batch dimensions are not equal: 512 vs. 1
Aborted
mace/mace/kernels/eltwise.h 860 have a bug,< should be <=,and gpu don't support matmul op,I replace it use FC op,and everything is ok.
@wayen820 happy to hear that. a few questions:
I have already post a PR. I found that dense layer in TensorFlow is also achieved through MATMUL, so there is no way to distinguish between the two in Mace. I replaced tensorflow_converter.py Matmul directly with FC Op
System information
Model deploy file (*.yml)
Describe the problem
I have a tensorflow model,and I have used conver.py tool to successfully convert to Mace,here is the convert log:
but when I try to run this model, it failed,here is the log:
it seems the last fullconnection layer went wrong,but I can't fix it. here is my model and yml file,https://share.weiyun.com/5P0FEoo