gpt4 book ai didi

python - 将 tensorflow 导入 Keras skript 时出现 LinAlgError ("SVD did not converge")

转载 作者:太空宇宙 更新时间:2023-11-03 14:35:32 25 4
gpt4 key购买 nike

导入tensorflow时出现以下错误:

Intel MKL ERROR: Parameter 4 was incorrect on entry to DLASCL.

Intel MKL ERROR: Parameter 4 was incorrect on entry to DLASCL. Traceback (most recent call last):
File "/xxx/skript.py", line 25, in h1 = LSTM(50)(input1) File "/xxx/anaconda3/lib/python3.6/site-packages/keras/layers/recurrent.py", line 268, in call return super(Recurrent, self).call(inputs, **kwargs)
File "/xxx/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 575, in call self.build(input_shapes[0])
File "/xxx/anaconda3/lib/python3.6/site-packages/keras/layers/recurrent.py", line 1034, in build constraint=self.recurrent_constraint)
File "/xxx/anaconda3/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 87, in wrapper return func(*args, **kwargs)
File "/xxx/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 396, in add_weight weight = K.variable(initializer(shape),
File "/xxx/anaconda3/lib/python3.6/site-packages/keras/initializers.py", line 247, in call u, _, v = np.linalg.svd(a, full_matrices=False)
File "/xxx/anaconda3/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 1389, in svd u, s, vt = gufunc(a, signature=signature, extobj=extobj)
File "/xxx/anaconda3/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 99, in _raise_linalgerror_svd_nonconvergence raise LinAlgError("SVD did not converge") numpy.linalg.linalg.LinAlgError: SVD did not converge

Process finished with exit code 1

使用通用脚本,您也可以将其用于测试:

import tensorflow as tf
from keras.models import Model
from keras.layers import Input
from keras.layers import Dense
from keras.layers import LSTM
from keras.layers.merge import Concatenate
import numpy as np


# Length of sequence.
sequence_length = 300
# Number of base features
num_features = 15
# Number of events
num_event_features = 20

# Input
input1 = Input(shape=(sequence_length, num_features))
# Build first LSTM on the first input.
h1 = LSTM(50)(input1)

# Apply the dense layer for prediction.
prediction = Dense(1)(h1)

# Define the keras model.
model = Model(inputs=[input1], outputs=[prediction])
model.compile(loss='binary_crossentropy', optimizer='adam',
metrics=['accuracy'])

# Generate some random data for testing.
X1 = np.random.rand(1000, sequence_length, num_features).astype(np.float32)
Y = np.random.choice([0, 1], size=1000).astype(np.float32)

# Train the model on random data.
model.fit(x=[X1], y=Y)

如果我删除 import tensorflow as tf,网络将被训练而不会出现错误消息。我正在使用 Keras 2.0.8、python 3.6 和tensorflow 1.3.0。安装 Tensorflow 是为了支持 Ubuntu、python 3.6 和 GPU。

最佳答案

安装 mkl-service 后我遇到了类似的问题。卸载它为我解决了这个问题。

关于python - 将 tensorflow 导入 Keras skript 时出现 LinAlgError ("SVD did not converge"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46979181/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com