Error: An operation has `None` for gradient with categorical_crossentropy
This link might be helpful to you. you might be missing something in your code.

https://github.com/keras-team/keras/issues/12521