sachinruk/deepschool.io

Lesson 19: Error while training. Please look into issue and help

gangooteli opened this issue · 0 comments

Code: Lesson 19 - Seq2Seq - Date translator - Solutions.ipynb
for epoch_i in range(epochs):
start_time = time.time()
for batch_i, (source_batch, target_batch) in enumerate(batch_data(X_train, y_train, batch_size)):
_, batch_loss, batch_logits = sess.run([optimizer, loss, logits],
feed_dict = {inputs: source_batch,
outputs: target_batch[:, :-1],
targets: target_batch[:, 1:]
})

Error:
ValueError Traceback (most recent call last)
in ()
9 feed_dict = {inputs: source_batch,
10 outputs: target_batch[:, :-1],
---> 11 targets: np.array(target_batch[:, 1:])
12 })
13 accuracy = np.mean(batch_logits.argmax(axis=-1) == target_batch[:,1:])

/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in run(self, fetches, feed_dict, options, run_metadata)
776 try:
777 result = self._run(None, fetches, feed_dict, options_ptr,
--> 778 run_metadata_ptr)
779 if run_metadata:
780 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _run(self, handle, fetches, feed_dict, options, run_metadata)
952 np_val = subfeed_val.to_numpy_array()
953 else:
--> 954 np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
955
956 if (not is_tensor_handle_feed and

/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/numpy/core/numeric.pyc in asarray(a, dtype, order)
529
530 """
--> 531 return array(a, dtype, copy=False, order=order)
532
533

ValueError: setting an array element with a sequence.