小编这次要给大家分享的是import tensorflow as tf出错怎么办,文章内容丰富,感兴趣的小伙伴可以来了解一下,希望大家阅读完这篇文章之后能够有所收获。

笔者在运行 import tensorflow as tf时出现下面的错误,但在运行import tensorflow时没有出错。

>>> import tensorflow as tfRuntimeError: module compiled against API version 0xc but this version of numpy is 0xaImportError: numpy.core.multiarray failed to importImportError: numpy.core.umath failed to importImportError: numpy.core.umath failed to import2018-12-09 01:22:17.925262: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr

后运行keras初级教程上的以下代码也报错:

# univariate lstm examplefrom numpy import arrayfrom keras.models import Sequentialfrom keras.layers import LSTMfrom keras.layers import Dense# define datasetX = array([[10, 20, 30], [20, 30, 40], [30, 40, 50], [40, 50, 60]])y = array([40, 50, 60, 70])# reshape from [samples, timesteps] into [samples, timesteps, features]X = X.reshape((X.shape[0], X.shape[1], 1))# define modelmodel = Sequential()model.add(LSTM(50, activation='relu', input_shape=(3, 1)))model.add(Dense(1))model.compile(optimizer='adam', loss='mse')# fit modelmodel.fit(X, y, epochs=1000, verbose=0)# demonstrate predictionx_input = array([50, 60, 70])x_input = x_input.reshape((1, 3, 1))yhat = model.predict(x_input, verbose=0)print(yhat)

看完这篇关于import tensorflow as tf出错怎么办的文章,如果觉得文章内容写得不错的话,可以把它分享出去给更多人看到。