Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit e52003b

Browse files
committed
Switch to enumerate in seq2seq ops
1 parent 1627cc1 commit e52003b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

skflow/ops/seq2seq_ops.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
from __future__ import division, print_function, absolute_import
1717

18-
from six.moves import xrange # pylint: disable=redefined-builtin
19-
2018
import tensorflow as tf
2119

2220
from skflow.ops import array_ops
@@ -95,15 +93,15 @@ def rnn_decoder(decoder_inputs, initial_state, cell, scope=None):
9593
states, sampling_states = [initial_state], [initial_state]
9694
outputs, sampling_outputs = [], []
9795
with tf.op_scope([decoder_inputs, initial_state], "training"):
98-
for i in xrange(len(decoder_inputs)):
96+
for i in enumerate(decoder_inputs):
9997
inp = decoder_inputs[i]
10098
if i > 0:
10199
tf.get_variable_scope().reuse_variables()
102100
output, new_state = cell(inp, states[-1])
103101
outputs.append(output)
104102
states.append(new_state)
105103
with tf.op_scope([initial_state], "sampling"):
106-
for i in xrange(len(decoder_inputs)):
104+
for i in enumerate(decoder_inputs):
107105
if i == 0:
108106
sampling_outputs.append(outputs[i])
109107
sampling_states.append(states[i])

0 commit comments

Comments
 (0)