This function can only be invoked before creating any graph, operation or tensor. It can be used at the beginning of a complex migration project from tensorflow 1. X to 2. X.
A simpler method is found. When referring to tensorflow, you can directly use:
Import tensorflow.compat.v1 as TF