Satyajit Pattnaik
Satyajit Pattnaik

Reputation: 135

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

I am using lstm predictor for timeseries prediction..

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..

Upvotes: 1

Views: 476

Answers (1)

I understand that your code imports the lstm_model from the file lstm_predictor.py when initializing your estimator. 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. The function split_squeeze also seems to be removed from the module 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. 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.

Upvotes: 3

Related Questions