12 for ii, (x, y) in enumerate(get_batches(train_x, train_y, batch_size), 1):
13 feed = {inputs_: x,
---> 14 labels_: y[:, None],
15 keep_prob: 0.5,
16 initial_state: state}
TypeError: list indices must be integers or slices, not tuple
As the error message states, y
is a list. So you cannot have two values in the brackets. That is how numpy arrays work. You should probably change your code to the following:
feed = {inputs_: x,
labels_: np.array(y)[:, None],
keep_prob: 0.5,
initial_state: state}
thanks but this method did not solve the problem. I found the solution when the problem is done as follows.
y = np.array(y)
feed = {inputs_: x,
labels_: y[:, None],
keep_prob: 0.5,
initial_state: state}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.