broadcast_add not support the NCHW format
hi,when i transform my NCHW format tensorflow model,I met the problem Check failed: l == 1 || r == 1 operands could not be broadcast together with shapes [1,256,16,16] [256], l=16, r=256,when i check the code ,I find the broadcast_add is only support the NHWC format.Is threre a plan to support it?
Thanks for posting this issue. Let me check .
thank you very much, I make a quick temporary fix to the problem,hope this can help someone. change code in nnvm/frontend/tensorflow.py line 417: change def _bias_add(): def _impl(inputs, attr, params): return _sym.broadcast_add(inputs[0], inputs[1]) return _impl to def _bias_add(): def _impl(inputs, attr, params): #print("inputs[1].shape is "+str(inputs[1].debug_str())) if 'data_format' in attr: attr['data_format'] = attr['data_format'].decode("utf-8") if attr['data_format'] == 'NCHW': data_shape_1 = attr['_input_shapes'][inputs[1]] data_shape_0 = attr['_input_shapes'][inputs[0]] inputs[1] = _sym.expand_dims(inputs[1], axis=0, num_newaxis=1) inputs[1] = _sym.expand_dims(inputs[1], axis=2, num_newaxis=2)
return _sym.broadcast_add(inputs[0], inputs[1])
return _impl
@liuchangready above changes looks good. feel free to push a PR for this along with a test case for this situation.
close due to inactive status, contribution is still welcomed