gpt4 book ai didi

python - Tensorflow 和 TFlearn 错误 - 意外参数 'keepdims'

转载 作者:行者123 更新时间:2023-11-30 22:16:12 25 4
gpt4 key购买 nike

我已在 Jetson Tx1 上安装了 Tensorflow 和 Tflearn。 Tensorflow 可以运行,并且我尝试运行的程序可以在我的 Mac 上运行。但是当我在我的jetson上运行它时出现这个错误。

Traceback (most recent call last):
File "net.py", line 164, in <module>
net = tflearn.regression(net, optimizer='adam', learning_rate=0.00001)
File "/usr/local/lib/python3.5/dist-packages/tflearn/layers/estimator.py", line 174, in regression
loss = objectives.get(loss)(incoming, placeholder)
File "/usr/local/lib/python3.5/dist-packages/tflearn/objectives.py", line 66, in categorical_crossentropy
keepdims=True)
TypeError: reduce_sum() got an unexpected keyword argument 'keepdims'

神经网络的代码

# Network building
net = tflearn.input_data([None, 25])
net = tflearn.embedding(net, input_dim=len(words), output_dim=256) #Embedding instead of one hot encoding.
net = tflearn.lstm(net, 256, dropout=0.9) #0.9, 0.00001, 30 was good -->63%
net = tflearn.fully_connected(net, 2, activation='softmax')
net = tflearn.regression(net, optimizer='adam', loss='categorical_crossentropy', learning_rate=0.00001)

# Training
model = tflearn.DNN(net, tensorboard_verbose=0)
model.fit(x_train, y_train, n_epoch=15, validation_set=(x_test, y_test), show_metric=True, batch_size=30)
model.save('mod.model')

最佳答案

对于 Tensorflow v1.4 或更低版本,保留维度的参数写作 keep_dims (带下划线)。 v1.5 中引入了这一更改(更改为 keepdims,目前具有复古兼容性)。

因此,您的 TLearn 版本对于您的 Tensorflow 来说可能太新。升级后者可能会解决您的问题。

关于python - Tensorflow 和 TFlearn 错误 - 意外参数 'keepdims',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50028940/

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