How can I fix the following error in Tensorflow 2.2? I prefer to convert the code to something compatible to work with TF2.2 not to use the compact version if possible.