Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name "reduce" is not defined #45

Open
Unicoranium opened this issue Jan 6, 2018 · 1 comment
Open

Name "reduce" is not defined #45

Unicoranium opened this issue Jan 6, 2018 · 1 comment

Comments

@Unicoranium
Copy link

I am running Windows 10 on a 2017 MacBook Pro using BootCamp so as far as I know I can't use gpu

When I run python main.py --env_name=Breakout-v0 --is_train=True --display=True --use_gpu=False I get this output

 [*] GPU : 1.0000
2018-01-06 17:07:58.156417: I C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
{'_save_step': 500000,
 '_test_step': 50000,
 'action_repeat': 4,
 'backend': 'tf',
 'batch_size': 32,
 'cnn_format': 'NHWC',
 'discount': 0.99,
 'display': True,
 'double_q': False,
 'dueling': False,
 'env_name': 'Breakout-v0',
 'env_type': 'detail',
 'ep_end': 0.1,
 'ep_end_t': 1000000,
 'ep_start': 1.0,
 'history_length': 4,
 'learn_start': 50000.0,
 'learning_rate': 0.00025,
 'learning_rate_decay': 0.96,
 'learning_rate_decay_step': 50000,
 'learning_rate_minimum': 0.00025,
 'max_delta': 1,
 'max_reward': 1.0,
 'max_step': 50000000,
 'memory_size': 1000000,
 'min_delta': -1,
 'min_reward': -1.0,
 'model': 'm1',
 'random_start': 30,
 'scale': 10000,
 'screen_height': 84,
 'screen_width': 84,
 'target_q_update_step': 10000,
 'train_frequency': 4}
Traceback (most recent call last):
  File "main.py", line 70, in <module>
    tf.app.run()
  File "C:\Users\Unicoranium\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 62, in main
    agent = Agent(config, env, sess)
  File "C:\Users\Unicoranium\Desktop\MachineLearning\DQN-tensorflow\DQN-tensorflow-master\dqn\agent.py", line 30, in __init__
    self.build_dqn()
  File "C:\Users\Unicoranium\Desktop\MachineLearning\DQN-tensorflow\DQN-tensorflow-master\dqn\agent.py", line 201, in build_dqn
    self.l3_flat = tf.reshape(self.l3, [-1, reduce(lambda x, y: x * y, shape[1:])])
NameError: name 'reduce' is not defined```

How can I fix it?
@kwanyoungpark
Copy link

I think it is import problem.
Try this:
from functools import reduce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants