瀏覽代碼

Merge: [Efficientnet/TF2] fix keras imports

Krzysztof Kudrynski 2 年之前
父節點
當前提交
96bdb5b35f
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      TensorFlow2/Classification/ConvNets/dataloader/augment.py

+ 5 - 1
TensorFlow2/Classification/ConvNets/dataloader/augment.py

@@ -26,7 +26,11 @@ import math
 import tensorflow as tf
 from typing import Any, Dict, List, Optional, Text, Tuple
 
-from keras.layers.preprocessing import image_preprocessing as image_ops
+try:
+    from keras.layers.preprocessing import image_preprocessing as image_ops
+except (ImportError, ModuleNotFoundError):
+    import keras.src.layers.preprocessing.image_preprocessing as image_ops
+
 
 # This signifies the max integer that the controller RNN could predict for the
 # augmentation scheme.