keras
keras copied to clipboard
Input has undefined rank. Received: input_shape=<unknown>
Tensorflow Version: 2.9.2 Python Version: 3.7.15
Bug's Behaviour:
A bug happened! I have created a derived version of AlexNet, I think BatchNormalization layers might be the cuprit behind the error. As without BatchNormalization layer it works perfectly fine.
I don't think it's relevant but I used some custom activation functions. with combination of "relu". Though those functions weren't that different from "relu" so, I don't expect any error. It'll be a great help, if someone can help me to solve this error :)
Relevant pointers and hints will also be appreciated!
Code that produces the error: # input_shape=(256, 256, 3) model.build(input_shape=(None, 220, 220, 3)) model.summary()
Relevant log output:
ValueError Traceback (most recent call last)
<ipython-input-16-a5158c5140ec> in <module>
1 # input_shape=(256, 256, 3)
----> 2 model.build(input_shape=(None, 256, 256, 3))
3 model.summary()
3 frames
/usr/local/lib/python3.7/dist-packages/keras/utils/tf_utils.py in validate_axis(axis, input_shape)
241 if not rank:
242 raise ValueError(
--> 243 f'Input has undefined rank. Received: input_shape={input_shape}')
244
245 # Convert axis to list and resolve negatives
ValueError: Input has undefined rank. Received: input_shape=<unknown>
I was suggested to post this issue here from Tensorflow repo: https://github.com/tensorflow/tensorflow/issues/58211#issuecomment-1286514372
@sleepingcat4, To expedite the trouble-shooting process, could you please provide a complete code and the TensorFlow version you are using. Thank you!
This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you.
Closing as stale. Please reopen if you'd like to work on this further.