Python 通过keras API保存tensorflow 2.0模型时发出警告

Python 通过keras API保存tensorflow 2.0模型时发出警告,python,tensorflow,keras,tensorflow2.0,Python,Tensorflow,Keras,Tensorflow2.0,在tensorflow 2.0中调用keras提供的Model.save()方法时,出现了两个有关不推荐操作的警告。下面附加了交互式模式下的简单复制 Python 3.8.3 (default, Jul 2 2020, 16:21:59) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license"

在tensorflow 2.0中调用keras提供的
Model.save()
方法时,出现了两个有关不推荐操作的警告。下面附加了交互式模式下的简单复制

Python 3.8.3 (default, Jul  2 2020, 16:21:59) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
2020-10-28 13:49:38.380026: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
>>> from tensorflow import keras
>>> inputs = keras.layers.Input(shape=(10, 10, 1), dtype="float32")
>>> outputs = keras.layers.Dense(2, activation="softmax")(inputs)
2020-10-28 13:50:33.646242: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2020-10-28 13:50:34.487222: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 
pciBusID: 0000:65:00.0 name: GeForce RTX 2080 Ti computeCapability: 7.5
coreClock: 1.545GHz coreCount: 68 deviceMemorySize: 10.76GiB deviceMemoryBandwidth: 573.69GiB/s
2020-10-28 13:50:34.487258: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-10-28 13:50:34.488671: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-10-28 13:50:34.490066: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcufft.so.10
2020-10-28 13:50:34.490334: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcurand.so.10
2020-10-28 13:50:34.491816: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusolver.so.10
2020-10-28 13:50:34.492589: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusparse.so.10
2020-10-28 13:50:34.495732: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
2020-10-28 13:50:34.496509: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2020-10-28 13:50:34.496780: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-10-28 13:50:34.519843: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 3799900000 Hz
2020-10-28 13:50:34.520483: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5584831adac0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-10-28 13:50:34.520504: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-10-28 13:50:34.592987: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x558483219530 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-10-28 13:50:34.593047: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): GeForce RTX 2080 Ti, Compute Capability 7.5
2020-10-28 13:50:34.594379: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 
pciBusID: 0000:65:00.0 name: GeForce RTX 2080 Ti computeCapability: 7.5
coreClock: 1.545GHz coreCount: 68 deviceMemorySize: 10.76GiB deviceMemoryBandwidth: 573.69GiB/s
2020-10-28 13:50:34.594439: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-10-28 13:50:34.594477: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-10-28 13:50:34.594503: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcufft.so.10
2020-10-28 13:50:34.594528: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcurand.so.10
2020-10-28 13:50:34.594553: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusolver.so.10
2020-10-28 13:50:34.594578: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusparse.so.10
2020-10-28 13:50:34.594603: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
2020-10-28 13:50:34.595938: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2020-10-28 13:50:34.595979: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-10-28 13:50:34.981431: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-10-28 13:50:34.981470: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]      0 
2020-10-28 13:50:34.981475: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1276] 0:   N 
2020-10-28 13:50:34.982333: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10063 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2080 Ti, pci bus id: 0000:65:00.0, compute capability: 7.5)
>>> model = keras.Model(inputs=inputs, outputs=outputs)
>>> model.save("test")
WARNING:tensorflow:From /home/boris/anaconda3/lib/python3.8/site-packages/tensorflow/python/training/tracking/tracking.py:111: Model.state_updates (from tensorflow.python.keras.engine.training) is deprecated and will be removed in a future version.
Instructions for updating:
This property should not be used in TensorFlow 2.0, as updates are applied automatically.
2020-10-28 13:51:05.487175: W tensorflow/python/util/util.cc:348] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.
WARNING:tensorflow:From /home/boris/anaconda3/lib/python3.8/site-packages/tensorflow/python/training/tracking/tracking.py:111: Layer.updates (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
This property should not be used in TensorFlow 2.0, as updates are applied automatically.
INFO:tensorflow:Assets written to: test/assets
>>> 
即使在保存非常简单的模型时,也会出现此警告消息,这让我感到困惑


我正在使用的确切版本是tensorflow 2.3.1和python 3.8.3。

它不会以任何方式影响您的代码。它只是说一些软件包计划在将来的版本中被删除。@DavidBacelj我知道这不会影响我的代码,但是应该有人来处理这些警告,要么是我,要么是tensorflow开发人员。我只是想弄清楚这和我有什么关系。它不会以任何方式影响你的代码。它只是说一些软件包计划在将来的版本中被删除。@DavidBacelj我知道这不会影响我的代码,但是应该有人来处理这些警告,要么是我,要么是tensorflow开发人员。我只是想弄清楚我和这件事有什么关系。