Forums - Value Error: Non broadcastable output operand

1 post / 0 new
Value Error: Non broadcastable output operand
ayush.bihani
Join Date: 31 Jan 18
Posts: 1
Posted: Thu, 2018-03-15 03:15

I have built a custom model using a simple feed forward neural network and my model conversion to dlc fails after the message "Building network"

Here is the output i get:

2018-03-15 15:38:31,480 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(input_tensor)
2018-03-15 15:38:31,481 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(input_tensor) [Placeholder])
2018-03-15 15:38:31,481 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(wb)
2018-03-15 15:38:31,481 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(wb/Variable) [Const])
2018-03-15 15:38:31,481 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(wb/Variable_1) [Const])
2018-03-15 15:38:31,481 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(wb/Variable_2) [Const])
2018-03-15 15:38:31,481 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(wb/Variable_3) [Const])
2018-03-15 15:38:31,481 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(wb/Variable_4) [Const])
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(wb/Variable_5) [Const])
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(wb/Variable_6) [Const])
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(wb/Variable_7) [Const])
2018-03-15 15:38:31,482 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(input_layer)
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(input_layer/MatMul) [MatMul])
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(input_layer/Add) [Add])
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(input_layer/Relu) [Relu])
2018-03-15 15:38:31,482 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(hidden_layer1)
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(hidden_layer1/MatMul) [MatMul])
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(hidden_layer1/Add) [Add])
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(hidden_layer1/Relu) [Relu])
2018-03-15 15:38:31,482 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(hidden_layer2)
2018-03-15 15:38:31,482 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(hidden_layer2/MatMul) [MatMul])
2018-03-15 15:38:31,483 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(hidden_layer2/Add) [Add])
2018-03-15 15:38:31,483 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(hidden_layer2/Relu) [Relu])
2018-03-15 15:38:31,483 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(output_layer)
2018-03-15 15:38:31,483 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(output_layer/MatMul) [MatMul])
2018-03-15 15:38:31,483 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(output_layer/Add) [Add])
2018-03-15 15:38:31,483 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(output_layer/output) [Softmax])
2018-03-15 15:38:32,372 - 301 - INFO - INFO_ALL_BUILDING_NETWORK:
==============================================================
Building Network
==============================================================
2018-03-15 15:38:32,372 - 326 - INFO - INFO_TF_BUILDING_INPUT_LAYER: Building layer (INPUT) with node: input_tensor, shape [1, 1, 12525]
2018-03-15 15:38:32,432 - 126 - ERROR - Encountered Error: non-broadcastable output operand with shape (1,1,1) doesn't match the broadcast shape (1,1,600)
Traceback (most recent call last):
  File "/home/ayush/Downloads/snpe-1.12.0/bin/x86_64-linux-clang/snpe-tensorflow-to-dlc", line 120, in main
    converter.convert(args.dlc, args.model_version, converter_command)
  File "/home/ayush/Downloads/snpe-1.12.0/lib/python/converters/tensorflow/converter.py", line 303, in convert
    self._convert_layers()
  File "/home/ayush/Downloads/snpe-1.12.0/lib/python/converters/tensorflow/converter.py", line 339, in _convert_layers
    descriptors = self._resolve_descriptors_from_nodes(graph_ops)
  File "/home/ayush/Downloads/snpe-1.12.0/lib/python/converters/tensorflow/converter.py", line 436, in _resolve_descriptors_from_nodes
    resolved_descriptors = resolver.resolve_layer(graph_matcher, self._graph_helper)
  File "/home/ayush/Downloads/snpe-1.12.0/lib/python/converters/tensorflow/layers/eltwise.py", line 97, in resolve_layer
    const_tensor = self._broadcast_tensor(const_tensor, eltwise_shape)
  File "/home/ayush/Downloads/snpe-1.12.0/lib/python/converters/tensorflow/layers/eltwise.py", line 127, in _broadcast_tensor
    broadcasted_tensor += tensor
ValueError: non-broadcastable output operand with shape (1,1,1) doesn't match the broadcast shape (1,1,600)

I tried debugging why i am getting the error and figured out that 600 here is the number of nodes in the hidden layers. But im unable to resolve this error. I have defined each layer operation within their own unique namespace. What is the resolution to this error?

  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.