[英]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.