rlworkgroup / garage

A toolkit for reproducible reinforcement learning research.
MIT License
1.88k stars 310 forks source link

torch.CNNModule rework #2189

Closed krzentner closed 3 years ago

krzentner commented 3 years ago

This change reworks garage.torch.CNNModule, to make it much more like other torch modules. In particular, it no longer takes an "input_var," as though it were a tensorflow module. It also delete CNNCategoricalModule, since it's unneeded, and fixes a major bug in CNNCategoricalPolicy. It also deletes the TransposeImage environment wrapper, since all CNNs can now handle images in NCHW and NHWC format.

This change does not delete CNNDiscreteModule, but that should be deleted soon as well.

krzentner commented 3 years ago

@Mergifyio rebase

mergify[bot] commented 3 years ago

Command rebase: failure

Branch rebase failed Git reported the following error:

First, rewinding head to replay your work on top of it...
Applying: Replace np_to_torch with as_tensor
Applying: Rework garage.torch.CNNModule
Using index info to reconstruct a base tree...
A examples/torch/dqn_atari.py
M src/garage/torch/modules/__init__.py
M src/garage/torch/modules/discrete_cnn_module.py
Falling back to patching base and 3-way merge...
Removing tests/garage/torch/modules/test_categorical_cnn_module.py
Auto-merging src/garage/torch/modules/discrete_cnn_module.py
CONFLICT (content): Merge conflict in src/garage/torch/modules/discrete_cnn_module.py
Removing src/garage/torch/modules/categorical_cnn_module.py
Auto-merging src/garage/torch/modules/__init__.py
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0002 Rework garage.torch.CNNModule
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

err-code: D81B2

krzentner commented 3 years ago

This change fixes #2231. It should be ready to merge now. Thanks Iris for fixing several of the pre-commit issues.

codecov[bot] commented 3 years ago

Codecov Report

Merging #2189 (8d7b78b) into master (f896dca) will increase coverage by 0.02%. The diff coverage is 97.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2189      +/-   ##
==========================================
+ Coverage   91.25%   91.28%   +0.02%     
==========================================
  Files         201      199       -2     
  Lines       10977    10932      -45     
  Branches     1371     1376       +5     
==========================================
- Hits        10017     9979      -38     
+ Misses        699      693       -6     
+ Partials      261      260       -1     
Impacted Files Coverage Δ
...rch/q_functions/discrete_dueling_cnn_q_function.py 91.30% <88.88%> (-1.56%) :arrow_down:
src/garage/torch/modules/cnn_module.py 97.53% <97.33%> (+17.84%) :arrow_up:
src/garage/torch/_functions.py 95.57% <100.00%> (+0.89%) :arrow_up:
src/garage/torch/algos/bc.py 89.61% <100.00%> (ø)
src/garage/torch/algos/ddpg.py 96.63% <100.00%> (ø)
src/garage/torch/algos/dqn.py 93.02% <100.00%> (ø)
src/garage/torch/algos/sac.py 97.05% <100.00%> (ø)
src/garage/torch/algos/td3.py 94.44% <100.00%> (ø)
src/garage/torch/modules/discrete_cnn_module.py 100.00% <100.00%> (ø)
...rc/garage/torch/policies/categorical_cnn_policy.py 100.00% <100.00%> (ø)
... and 6 more

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 f896dca...8d7b78b. Read the comment docs.