value error :total size of new array must be unchanged
munirfarzeen opened this issue · 14 comments
getting this error on line 167,
any idea why?
@likui01 could you please paste the error
mlv@mlv-dl:/likui/segnet-master$ /usr/bin/python2 segnet.py/likui/segnet-master$
ERROR (theano.sandbox.cuda): nvcc compiler not found on $PATH. Check your nvcc installation and try again.
Using Theano backend.
...............................................................................................................................................................................................................................................................................................................................................................................37
Traceback (most recent call last):
File "segnet.py", line 171, in
autoencoder.add(Reshape((12,data_shape)))
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 308, in add
output_tensor = layer(self.outputs[0])
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 514, in call
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 572, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 152, in create_node
output_shapes = to_list(outbound_layer.get_output_shape_for(input_shapes[0]))
File "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 304, in get_output_shape_for
return (input_shape[0],) + self._fix_unknown_dimension(input_shape[1:], self.target_shape)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 299, in _fix_unknown_dimension
raise ValueError(msg)
ValueError: total size of new array must be unchanged
mlv@mlv-dl:
Hello, I am facing the same issue, whether I use nvcc or not.
@likui01 in the opensourced file reshape layer line is 167 (https://github.com/pradyu1993/segnet/blob/master/segnet.py#L167) but in the error it is 171
did you add new code to file? If so could you gist the file and paste the link so that I can reproduce the error.
@likui01 could you comment out, line no. 132 in your code and run the code again
still the same error
still the same error
@waissbluth did you resolve this issue?
@pradyu1993 what could be the possible reason for the error??
the encoder layers compile fine, but it give error in reshape, why?
@likui01 error is because we are hard coding the data_shape variable and the output of last convolution layer in decoder is different from data_shape
@pradyu1993 how to resolve it??
doesnt reshape function change the matrix size???
@likui01 sorry for the late response, was little busy. Could you print out the output shape of the layer before reshape layer
for i in autoencoder: print i, autoencoder[i].get_shape()
that could help us debug the issue
i resolve the issue, the problem was dimension ordering. tf or th. by default it was considering tf. so have to state the dimension ordering for each layer.
so now it compile.
thank you for the efforts!!
@likui01 not a issue. Glad you figured it out.