starcraft2-ai / rl-battle

GNU General Public License v3.0
2 stars 1 forks source link

tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute MatMul as input #0 #40

Closed Willian-Zhang closed 6 years ago

Willian-Zhang commented 6 years ago

https://github.com/starcraft2-ai/rl-battle/blob/9dd5a8292041c8e0ad3da947805aaf1f0eeeda81/Networks/atari.py#L42

I0430 00:29:34.575233 140735624741760 sc2_env.py:240] Starting episode: 1
Took 0.210 seconds for 1 steps: 4.767 fps
I0430 00:29:34.749185 140735624741760 sc2_env.py:327] Environment Close
I0430 00:29:34.814204 140735624741760 sc2_env.py:342]
Traceback (most recent call last):
  File "/Users/willian/Github/starcraft2-ai/rl-battle/run.py", line 109, in <module>
    app.run(main)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/.env/lib/python3.6/site-packages/absl/app.py", line 274, in run
    _run_main(main, argv)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/.env/lib/python3.6/site-packages/absl/app.py", line 238, in _run_main
    sys.exit(main(argv))
  File "/Users/willian/Github/starcraft2-ai/rl-battle/run.py", line 85, in main
    run_thread(agent_cls, FLAGS.map, FLAGS.render)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/run.py", line 63, in run_thread
    run_loop.run_loop([agent], env, FLAGS.max_agent_steps)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/.env/lib/python3.6/site-packages/pysc2/env/run_loop.py", line 41, in run_loop
    for agent, timestep in zip(agents, timesteps)]
  File "/Users/willian/Github/starcraft2-ai/rl-battle/.env/lib/python3.6/site-packages/pysc2/env/run_loop.py", line 41, in <listcomp>
    for agent, timestep in zip(agents, timesteps)]
  File "/Users/willian/Github/starcraft2-ai/rl-battle/agent/atari_agent.py", line 44, in step
    (spatial_action, non_spatial_action, value) = self.model.predict(x)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/Networks/atari.py", line 67, in predict
    return self.call(inputs)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/Networks/atari.py", line 42, in call
    info_fc = self.info_fc(info)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/.env/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/engine/base_layer.py", line 239, in __call__
    output = super(Layer, self).__call__(inputs, **kwargs)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/.env/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 714, in __call__
    outputs = self.call(inputs, *args, **kwargs)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/.env/lib/python3.6/site-packages/tensorflow/python/layers/core.py", line 163, in call
    outputs = gen_math_ops.mat_mul(inputs, self.kernel)
  File "/Users/willian/Github/starcraft2-ai/rl-battle/.env/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 4234, in mat_mul
    _six.raise_from(_core._status_to_exception(e.code, message), None)
  File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute MatMul as input #0 was expected to be a float tensor but is a double tensor [Op:MatMul]
I0430 00:29:34.917540 140735624741760 sc2_env.py:327] Environment Close
I0430 00:29:34.917775 140735624741760 sc2_env.py:342]
I0430 00:29:34.917910 140735624741760 sc2_env.py:327] Environment Close
I0430 00:29:34.918029 140735624741760 sc2_env.py:342]
Terminated: 15
Willian-Zhang commented 6 years ago

debug info

> x[0].shape
TensorShape([Dimension(1), Dimension(7), Dimension(64), Dimension(64)])
> x[1].shape
TensorShape([Dimension(1), Dimension(17), Dimension(84), Dimension(84)])
> x[2].shape
TensorShape([Dimension(1), Dimension(524)])
jimmyahacker commented 6 years ago

@Willian-Zhang What is the meaning of this debug info?

Willian-Zhang commented 6 years ago
x = (screen, minimap, info)