简体   繁体   English

AttributeError:模块“ tensorflow.contrib.learn.python.learn.ops”没有属性“ split_squeeze”

[英]AttributeError: module 'tensorflow.contrib.learn.python.learn.ops' has no attribute 'split_squeeze'

I am using lstm predictor for timeseries prediction.. 我正在使用lstm预测器进行时间序列预测。

regressor = skflow.Estimator(model_fn=lstm_model(TIMESTEPS, RNN_LAYERS, DENSE_LAYERS))

validation_monitor = learn.monitors.ValidationMonitor(X['val'], y['val'],
                                                      every_n_steps=PRINT_STEPS,
                                                      early_stopping_rounds=1000)

regressor.fit(X['train'], y['train'], monitors=[validation_monitor])

But while doing regressor.fit, i am getting the error as shown in Title, need help on this.. 但是在执行regressor.fit时,出现标题所示的错误,需要帮助。

I understand that your code imports the lstm_model from the file lstm_predictor.py when initializing your estimator. 我了解您的代码在初始化估算器时会从文件lstm_predictor.py导入lstm_model If so, the problem is caused by the following line: 如果是这样,则问题是由以下行引起的:

x_ = learn.ops.split_squeeze(1, time_steps, X)

As the README.md of that repo tells, the Tensorflow API has changed significantly . 正如该仓库的README.md所说, Tensorflow API发生了显着变化 The function split_squeeze also seems to be removed from the module tensorflow.contrib.learn.python.ops. 函数split_squeeze似乎也已从tensorflow.contrib.learn.python.ops模块中删除。 This issue has been discussed in that repository but no changes have been made in that repo since 2 years! 该存储库中已讨论了此问题,但是自两年以来,该存储库中未进行任何更改!

Yet, you can simply replace that function with tf.unstack . 但是,您只需将其替换为tf.unstack即可 So simply change the line as: 因此,只需将行更改为:

x_ =  tf.unstack(X, num=time_steps, axis=1)

With this I was able to get past the problem. 这样我就可以解决问题了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError:模块'tensorflow.contrib.learn'没有属性'TensorFlowDNNClassifier' - AttributeError: module 'tensorflow.contrib.learn' has no attribute 'TensorFlowDNNClassifier' 模块'tensorflow.contrib.learn'没有属性'python' - module 'tensorflow.contrib.learn' has no attribute 'python' AttributeError: 模块“tensorflow.python.framework.ops”没有属性“RegisterShape” - AttributeError: module 'tensorflow.python.framework.ops' has no attribute 'RegisterShape' AttributeError:模块'tensorflow.python.framework.ops'没有属性'_TensorLike' - AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' Tensorflow:没有名为 contrib.learn.python.learn.datasets.mnist 的模块 - Tensorflow: No module named contrib.learn.python.learn.datasets.mnist 'tensorflow.python.framework.ops.EagerTensor' 对象没有属性 'squeeze' - 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'squeeze' 导入tensorflow contrib学习python学习 - Import tensorflow contrib learn python learn Tensorflow模块导入错误:AttributeError:模块'tensorflow.python.ops.nn'没有属性'rnn_cell' - Tensorflow Module Import error: AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'rnn_cell' tensorflow 中的 add 方法问题:AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' - Issue with add method in tensorflow : AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' Tensorflow:AttributeError:模块'tensorflow.python'没有属性'control_flow_ops' - Tensorflow: AttributeError: module 'tensorflow.python' has no attribute 'control_flow_ops'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM