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

TypeError: unbound method _TensorBase.detach() needs an argument #2

Open
Andrei-Iosifescu123 opened this issue Jan 25, 2023 · 0 comments

Comments

@Andrei-Iosifescu123
Copy link

Andrei-Iosifescu123 commented Jan 25, 2023

Hi, I get this error when I try to train it with python3 main.py train --save_path /home/andrei/td-gammon/td_gammon/saved_models/exp1 --save_step 10000 --episodes 100000 --name exp1 --type nn --lr 0.1 --hidden_units 40. This is the full output:

Traceback (most recent call last):
  File "/home/andrei/td-gammon/td_gammon/main.py", line 68, in <module>
    args.func(args)
  File "/home/andrei/td-gammon/td_gammon/utils.py", line 72, in args_train
    net.train_agent(env=env, n_episodes=n_episodes, save_path=save_path, save_step=save_step, eligibility=eligibility, name_experiment=name)
  File "/home/andrei/td-gammon/td_gammon/model.py", line 91, in train_agent
    action = agent.choose_best_action(actions, env)
  File "/home/andrei/td-gammon/td_gammon/agents.py", line 80, in choose_best_action
    best_action_index = int(np.argmax(values)) if self.color == WHITE else int(np.argmin(values))
  File "<__array_function__ internals>", line 200, in argmin
  File "/home/andrei/.local/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 1338, in argmin
    return _wrapfunc(a, 'argmin', axis=axis, out=out, **kwds)
  File "/home/andrei/.local/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 54, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/home/andrei/.local/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 43, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
  File "/home/andrei/.local/lib/python3.10/site-packages/torch/_tensor.py", line 956, in __array__
    return Tensor.detach().numpy()
TypeError: unbound method _TensorBase.detach() needs an argument
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

1 participant