|
16 | 16 | from __future__ import division, print_function, absolute_import |
17 | 17 |
|
18 | 18 | import tensorflow as tf |
19 | | -from tensorflow.models.rnn import rnn, rnn_cell |
20 | 19 |
|
21 | 20 | from skflow.ops import mean_squared_error_regressor, softmax_classifier, dnn |
22 | 21 |
|
@@ -133,16 +132,16 @@ def rnn_estimator(X, y): |
133 | 132 | raise ValueError("cell_type {} is not supported. ".format(cell_type)) |
134 | 133 | if bidirection: |
135 | 134 | # forward direction cell |
136 | | - rnn_fw_cell = rnn_cell.MultiRNNCell([cell_fn(rnn_size)] * num_layers) |
| 135 | + rnn_fw_cell = tf.nn.rnn_cell.MultiRNNCell([cell_fn(rnn_size)] * num_layers) |
137 | 136 | # backward direction cell |
138 | | - rnn_bw_cell = rnn_cell.MultiRNNCell([cell_fn(rnn_size)] * num_layers) |
| 137 | + rnn_bw_cell = tf.nn.rnn_cell.MultiRNNCell([cell_fn(rnn_size)] * num_layers) |
139 | 138 | # pylint: disable=unexpected-keyword-arg, no-value-for-parameter |
140 | | - encoding = rnn.bidirectional_rnn(rnn_fw_cell, rnn_bw_cell, |
| 139 | + encoding = tf.nn.rnn.bidirectional_rnn(rnn_fw_cell, rnn_bw_cell, |
141 | 140 | sequence_length=sequence_length, |
142 | 141 | initial_state=initial_state) |
143 | 142 | else: |
144 | | - cell = rnn_cell.MultiRNNCell([cell_fn(rnn_size)] * num_layers) |
145 | | - _, encoding = rnn.rnn(cell, X, dtype=tf.float32, |
| 143 | + cell = tf.nn.rnn_cell.MultiRNNCell([cell_fn(rnn_size)] * num_layers) |
| 144 | + _, encoding = tf.nn.rnn.rnn(cell, X, dtype=tf.float32, |
146 | 145 | sequence_length=sequence_length, |
147 | 146 | initial_state=initial_state) |
148 | 147 | return target_predictor_fn(encoding[-1], y) |
|
0 commit comments