tensorFlow和numpy的futureWarning

情景描述:

在使用SpecAugment包时,from specAugment import spec_augment_tensorflow 报警告,警告如下:

FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
_np_qint8 = np.dtype([(“qint8”, np.int8, 1)])

原因:

参考:FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future ver

  • 在TensorFlow 2.0.b1的版本下,如果Numpy的版本超过了1.17,那么就会出现这个警告。

解决

  1. 回退版本:
pip install "numpy<1.17"
  1. 手动忽略警告
import warnings
warnings.filterwarnings('ignore', category=FutureWarning)

猜你喜欢

转载自blog.csdn.net/u013894391/article/details/103254913