Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从tensorflow1迁移到tf2,为什么转换后的脚本仍然可以使用tf1?_Tensorflow - Fatal编程技术网

从tensorflow1迁移到tf2,为什么转换后的脚本仍然可以使用tf1?

从tensorflow1迁移到tf2,为什么转换后的脚本仍然可以使用tf1?,tensorflow,Tensorflow,我需要将一个项目从tf1迁移到tf2,我看到了这个官方教程,它写得非常好。这是: Recommended upgrade process The rest of this guide demonstrates how to use the upgrade script. While the upgrade script is easy to use, it is strongly recommended that you use the script as part of the follow

我需要将一个项目从tf1迁移到tf2,我看到了这个官方教程,它写得非常好。这是:

Recommended upgrade process

The rest of this guide demonstrates how to use the upgrade script. While the upgrade script is easy to use, it is strongly recommended that you use the script as part of the following process:

1. Unit Test: Ensure that the code you’re upgrading has a unit test suite with reasonable coverage. This is Python code, so the language won’t protect you from many classes of mistakes. Also ensure that any dependency you have has already been upgraded to be compatible with TensorFlow 2.0. 
2.Install TensorFlow 1.14: Upgrade your TensorFlow to the latest TensorFlow 1.x version, at least 1.14. This includes the final TensorFlow 2.0 API in tf.compat.v2. 
3.Test With 1.14: Ensure your unit tests pass at this point. You’ll be running >them repeatedly as you upgrade so starting from green is important. 
4.Run the upgrade script: Run tf_upgrade_v2 on your entire source tree, tests included.This will upgrade your code to a format where it only uses symbols available in TensorFlow 2.0. Deprecated symbols will be accessed with tf.compat.v1. These will eventually require manual attention, but not immediately. 
5. Run the converted tests with TensorFlow 1.14: Your code should still run fine in TensorFlow 1.14. Run your unit tests again. Any error in your tests here means there’s a bug in the upgrade script. Please let us know. 
6. Check the upgrade report for warnings and errors: The script writes a report file that explains any conversions you should double-check, or any manual action you need to take. For example: Any remaining instances of contrib will require manual action to remove. Please consult the RFC for more instructions. 
7.Install TensorFlow 2.0: At this point, it should be safe to switch to TensorFlow 2.0
我的问题是,为什么我们仍然可以在步骤5中使用TensorFlow 1.14运行转换测试?此时脚本是否已升级到tf2版本?我想这可能与TensorFlow的向后兼容性有关,有人能解释一下吗