Returns whether tensorflow is operating in V2 mode.
()
| 19 | |
| 20 | |
| 21 | def is_tfv2(): |
| 22 | """ |
| 23 | Returns whether tensorflow is operating in V2 mode. |
| 24 | """ |
| 25 | try: |
| 26 | from tensorflow.python import tf2 |
| 27 | return tf2.enabled() |
| 28 | except Exception: |
| 29 | return False |
| 30 | |
| 31 | |
| 32 | if is_tfv2(): |
no outgoing calls
no test coverage detected