这是indexloc提供的服务,不要输入任何密码
Skip to content

Remove dummy net code #123

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

Merged
merged 11 commits into from
Jul 9, 2020
Merged

Conversation

youkaichao
Copy link
Collaborator

  • I have marked all applicable categories:
    • exception-raising fix
    • algorithm implementation fix
    • documentation modification
    • new feature
  • If applicable, I have mentioned the relevant/related issue(s)

Less important but also useful:

  • I have visited the source website, and in particular read the known issues
  • I have searched through the issue tracker and issue categories for duplicates
  • I have mentioned version numbers, operating system and environment, where applicable:
    import tianshou, torch, sys
    print(tianshou.__version__, torch.__version__, sys.version, sys.platform)

@codecov-commenter
Copy link

Codecov Report

Merging #123 into master will decrease coverage by 1.43%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #123      +/-   ##
==========================================
- Coverage   84.94%   83.50%   -1.44%     
==========================================
  Files          29       32       +3     
  Lines        1906     2092     +186     
==========================================
+ Hits         1619     1747     +128     
- Misses        287      345      +58     
Flag Coverage Δ
#unittests 83.50% <100.00%> (-1.44%) ⬇️
Impacted Files Coverage Δ
tianshou/utils/net/common.py 100.00% <100.00%> (ø)
tianshou/utils/net/continuous.py 61.11% <100.00%> (ø)
tianshou/utils/net/discrete.py 52.08% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa3c453...e415320. Read the comment docs.

@duburcqa
Copy link
Collaborator

duburcqa commented Jul 9, 2020

Why not to keep the original names Actor / Critic? I think it is clearer. I don't see any advantage of introducing extra postfix Head. It is not confusing since Net is clearly not an Actor or Critic on its own.

@youkaichao
Copy link
Collaborator Author

Why not to keep the original names Actor / Critic? I think it is clearer. I don't see any advantage of introducing extra postfix Head. It is not confusing since Net is clearly not an Actor or Critic on its own.

Good idea, solved in new commit.

@Trinkle23897 Trinkle23897 merged commit e767de0 into thu-ml:master Jul 9, 2020
@youkaichao youkaichao deleted the remove_dummy_net branch July 9, 2020 15:04
Comment on lines +63 to +73
net = Net(args.layer_num, args.state_shape, device=args.device)
actor = Actor(
args.layer_num, args.state_shape, args.action_shape,
net, args.action_shape,
args.max_action, args.device
).to(args.device)
actor_optim = torch.optim.Adam(actor.parameters(), lr=args.actor_lr)
critic1 = Critic(
args.layer_num, args.state_shape, args.action_shape, args.device
).to(args.device)
net = Net(args.layer_num, args.state_shape,
args.action_shape, concat=True, device=args.device)
critic1 = Critic(net, args.device).to(args.device)
critic1_optim = torch.optim.Adam(critic1.parameters(), lr=args.critic_lr)
critic2 = Critic(
args.layer_num, args.state_shape, args.action_shape, args.device
).to(args.device)
critic2 = Critic(net, args.device).to(args.device)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, TD3 cannot support share-critic, which causes #209.

BFAnas pushed a commit to BFAnas/tianshou that referenced this pull request May 5, 2024
* remove dummy net; delete two files

* split code to have backbone and head

* rename class

* change torch.float to torch.float32

* use flatten(1) instead of view(batch, -1)

* remove dummy net in docs

* bugfix for rnn

* fix cuda error

* minor fix of docs

* do not change the example code in dqn tutorial, since it is for demonstration

Co-authored-by: Trinkle23897 <463003665@qq.com>
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

Successfully merging this pull request may close these issues.

4 participants