问题
在Pycharm中运行import tensorflow as tf时报错。

解决方案
此时点开报错中的dtypes.py文件,对其进行修改。
# hard-coding of names.这里开始,修改所有以_np_q开头的代码行,同时也要修改最后一行的np_resource

# hard-coding of names.
_np_qint8 = np.dtype([("qint8", np.int8, (1,))])
_np_quint8 = np.dtype([("quint8", np.uint8, (1,))])
_np_qint16 = np.dtype([("qint16", np.int16, (1,))])
_np_quint16 = np.dtype([("quint16", np.uint16, (1,))])
_np_qint32 = np.dtype([("qint32", np.int32, (1,))])

# _np_bfloat16 is defined by a module import.

# Custom struct dtype for directly-fed ResourceHandles of supported type(s).
np_resource = np.dtype([("resource", np.ubyte, (1,))])
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐