Wroking on policy 0
Horizon 0 ==========
Epoch 0 | loss: 85.31 | time took: 1.91s | validation loss: 36.48
Total time took: 0.05hrs
Horizon 2 ==========
InvalidArgumentError Traceback (most recent call last)
C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
1360 try:
-> 1361 return fn(*args)
1362 except errors.OpError as e:
C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _run_fn(session, feed_dict, fetch_list, target_list, options, run_metadata)
1339 return tf_session.TF_Run(session, options, feed_dict, fetch_list,
-> 1340 target_list, status, run_metadata)
1341
C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py in exit(self, type_arg, value_arg, traceback_arg)
515 compat.as_text(c_api.TF_Message(self.status.status)),
--> 516 c_api.TF_GetCode(self.status.status))
517 # Delete the underlying status object from memory otherwise it stays alive
InvalidArgumentError: TensorArray TensorArray_3809: Could not read index 1 twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).
[[Node: rnn/while/cond/cond/TensorArrayReadV3_2 = TensorArrayReadV3[dtype=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](rnn/while/cond/cond/TensorArrayReadV3_1/Switch, rnn/while/cond/cond/TensorArrayReadV3_1/Switch_1, rnn/while/cond/cond/TensorArrayReadV3_1/Switch_2)]]
During handling of the above exception, another exception occurred:
InvalidArgumentError Traceback (most recent call last)
in ()
1 batch_size = 32
----> 2 train_all_single_policies(batch_size, sequence_length, train_game, train_target, test_game, test_target, models_path)
C:\Users\sshi\Desktop\raptors\code\train.py in train_all_single_policies(batch_size, sequence_length, train_game, train_target, test_game, test_target, models_path)
31 for batch in iterate_minibatches(train_game, train_target, batch_size, shuffle=False):
32 train_xi, train_yi = batch
---> 33 p, l, _, train_sum = model.train(train_xi, train_yi, k)
34 model.train_writer.add_summary(train_sum, train_step)
35 epoch_loss += l/n_train_batch
C:\Users\sshi\Desktop\raptors\code\model.py in train(self, train_xi, train_yi, k)
124 def train(self, train_xi, train_yi, k):
125 return self.sess.run([self.pred, self.loss, self.opt, self.train_summary],
--> 126 feed_dict={self.X: train_xi, self.Y: train_yi, self.h: k})
127
128 def validate(self, val_xi, val_yi, k):
C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in run(self, fetches, feed_dict, options, run_metadata)
903 try:
904 result = self._run(None, fetches, feed_dict, options_ptr,
--> 905 run_metadata_ptr)
906 if run_metadata:
907 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
1135 if final_fetches or final_targets or (handle and feed_dict_tensor):
1136 results = self._do_run(handle, final_targets, final_fetches,
-> 1137 feed_dict_tensor, options, run_metadata)
1138 else:
1139 results = []
C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
1353 if handle is None:
1354 return self._do_call(_run_fn, self._session, feeds, fetches, targets,
-> 1355 options, run_metadata)
1356 else:
1357 return self._do_call(_prun_fn, self._session, handle, feeds, fetches)
C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
1372 except KeyError:
1373 pass
-> 1374 raise type(e)(node_def, op, message)
1375
1376 def _extend_graph(self):
InvalidArgumentError: TensorArray TensorArray_3809: Could not read index 1 twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).
[[Node: rnn/while/cond/cond/TensorArrayReadV3_2 = TensorArrayReadV3[dtype=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](rnn/while/cond/cond/TensorArrayReadV3_1/Switch, rnn/while/cond/cond/TensorArrayReadV3_1/Switch_1, rnn/while/cond/cond/TensorArrayReadV3_1/Switch_2)]]
Caused by op 'rnn/while/cond/cond/TensorArrayReadV3_2', defined at:
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\ipykernel\kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\eventloop\ioloop.py", line 177, in start
super(ZMQIOLoop, self).start()
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tornado\ioloop.py", line 888, in start
handler_func(fd_obj, events)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 440, in _handle_events
self._handle_recv()
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 472, in _handle_recv
self._run_callback(callback, msg)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 414, in _run_callback
callback(*args, **kwargs)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 235, in dispatch_shell
handler(stream, idents, msg)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 399, in execute_request
user_expressions, allow_stdin)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\ipykernel\ipkernel.py", line 196, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\ipykernel\zmqshell.py", line 533, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2717, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2827, in run_ast_nodes
if self.run_code(code, result):
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 2, in
train_all_single_policies(batch_size, sequence_length, train_game, train_target, test_game, test_target, models_path)
File "C:\Users\sshi\Desktop\raptors\code\train.py", line 14, in train_all_single_policies
learning_rate=0.01, seq_len=sequence_length-1)
File "C:\Users\sshi\Desktop\raptors\code\model.py", line 85, in init
policy_number=self.policy_number)
File "C:\Users\sshi\Desktop\raptors\code\model.py", line 41, in dynamic_raw_rnn
outputs_ta, last_state, _ = tf.nn.raw_rnn(cell, loop_fn)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\rnn.py", line 1154, in raw_rnn
swap_memory=swap_memory)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3096, in while_loop
result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2874, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2814, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\rnn.py", line 1115, in body
next_time, next_output, cell_state, loop_state)
File "C:\Users\sshi\Desktop\raptors\code\model.py", line 33, in loop_fn
lambda: tf.cond(tf.equal(tf.mod(time, horizon+1), tf.constant(0)),
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 432, in new_func
return func(args, **kwargs)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2027, in cond
orig_res_f, res_f = context_f.BuildCondBranch(false_fn)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 1868, in BuildCondBranch
original_result = fn()
File "C:\Users\sshi\Desktop\raptors\code\model.py", line 35, in
lambda: tf.concat((inputs_ta.read(time)[:, :policy_numberplayer_fts],
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 432, in new_func
return func(args, **kwargs)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2027, in cond
orig_res_f, res_f = context_f.BuildCondBranch(false_fn)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 1868, in BuildCondBranch
original_result = fn()
File "C:\Users\sshi\Desktop\raptors\code\model.py", line 37, in
inputs_ta.read(time)[:, policy_numberplayer_fts+2:]), axis=1)))
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\util\tf_should_use.py", line 58, in fn
return method(self, *args, **kwargs)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\util\tf_should_use.py", line 58, in fn
return method(self, *args, **kwargs)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\util\tf_should_use.py", line 58, in fn
return method(self, *args, **kwargs)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\tensor_array_ops.py", line 861, in read
return self._implementation.read(index, name=name)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\tensor_array_ops.py", line 260, in read
name=name)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_data_flow_ops.py", line 4970, in _tensor_array_read_v3
dtype=dtype, name=name)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3271, in create_op
op_def=op_def)
File "C:\Users\sshi\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1650, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): TensorArray TensorArray_3809: Could not read index 1 twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).
[[Node: rnn/while/cond/cond/TensorArrayReadV3_2 = TensorArrayReadV3[dtype=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](rnn/while/cond/cond/TensorArrayReadV3_1/Switch, rnn/while/cond/cond/TensorArrayReadV3_1/Switch_1, rnn/while/cond/cond/TensorArrayReadV3_1/Switch_2)]]