“synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.” problem in TensorFlow

前端 未结 7 1818
-上瘾入骨i
-上瘾入骨i 2020-12-08 18:43

I installed TensorFlow 1.10.1 but when I tried to import TensorFlow it said that I need TensorFlow version 1.10.0. Thus, I installed it and now I get the following warnings:

7条回答
  •  囚心锁ツ
    2020-12-08 19:29

    The newest numpy release notes (1.17) has:

    Future Changes
    
    Shape-1 fields in dtypes won’t be collapsed to scalars in a future version
    Currently, a field specified as [(name, dtype, 1)] or "1type" is interpreted 
    as a scalar field (i.e., the same as [(name, dtype)] or [(name, dtype, ()]). 
    This now raises a FutureWarning; in a future version, it will be interpreted 
    as a shape-(1,) field, i.e. the same as [(name, dtype, (1,))] or "(1,)type" 
    (consistently with [(name, dtype, n)] / "ntype" with n>1, which is already 
    equivalent to [(name, dtype, (n,)] / "(n,)type").
    

    https://docs.scipy.org/doc/numpy/release.html

    Thus with your expression:

    In [123]: np.dtype([("qint8", np.int8, 1)])                                                                  
    /usr/local/bin/ipython3:1: 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'.
      #!/usr/bin/python3
    Out[123]: dtype([('qint8', 'i1')])
    
    In [124]: np.dtype([("qint8", np.int8, (1,))])                                                               
    Out[124]: dtype([('qint8', 'i1', (1,))])
    
    In [125]: np.dtype([("qint8", np.int8)])                                                                     
    Out[125]: dtype([('qint8', 'i1')])
    
    In [126]: np.dtype([("qint8", np.int8, 2)])                                                                  
    Out[126]: dtype([('qint8', 'i1', (2,))])
    
    In [127]: np.__version__                                                                                     
    Out[127]: '1.17.0'
    

提交回复
热议问题