본문 바로가기

Programming/Python

[Python] Tensorflow import 경고 메세지 (numpy)

텐서플로우 설치 후, 다음과 같은 경고 메세지가 뜨는 경우가 있다.

$ python
Python 3.7.4 (Default, Feb 26 2020, 21:18:37)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information
>>> import tensorflow as tf
/home/linux-LAB/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:526: 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)])
/home/linux-LAB/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:527: 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_quint8=np.dtype([("quint8", np.uint8, 1)])
/home/linux-LAB/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:528: 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_qint16=np.dtype([("qint16", np.int16, 1)])
/home/linux-LAB/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:529: 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_quint16=np.dtype([("quint16", np.uint16, 1)])
/home/linux-LAB/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:530: 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_qint32=np.dtype([("qint32", np.int32, 1)])
/home/linux-LAB/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:535: 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_resource=np.dtype([("resource", np.ubyte, 1)])

기존에는 [(name, dtype, 1)] 또는 "1type"이 스칼라 타입, 즉 [(name, dtype)] 또는 [(name, dtype, ())] 으로 다루어졌지만, 1.17 버전에서는 [(name, dtype, (1,))] 또는 "(1,)type"으로 취급된다는 경고메세지이다.
이 경고메세지와 관련해서는 다음 링크에서 확인할 수 있다.

https://docs.scipy.org/doc/numpy/release.html#future-changes 

기존에 설치되어 있던 numpy 버전이 1.17이상이라면 설치되어 있는 numpy를 제거하고 1.17 아래 버전으로 재설치하면 문제가 해결된다.

$ pip install "numpy<1.17"

 

References

텐서플로우 임포팅 경고 메세지 synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / "(1,)type"