Can you please show us a snippet of your code which is throwing the error?
Also please check if this error persists if SGD is used instead of Adam. If that’s the case, then there might be an issue with batch size mismatch.