-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework garage.torch.CNNModule (#2189)
It now takes an env spec and automatically computes the output size. It also handles NHWC and NCHW instead of requiring an environment wrapper. This change also fixes several issues with the existing usage of CNNs in pytorch.
- Loading branch information
Showing
29 changed files
with
726 additions
and
1,097 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
"""PyTorch-backed modules and algorithms.""" | ||
# yapf: disable | ||
from garage.torch._functions import (compute_advantages, dict_np_to_torch, | ||
from garage.torch._functions import (as_torch, as_torch_dict, | ||
compute_advantages, expand_var, | ||
filter_valids, flatten_batch, | ||
flatten_to_single_vector, global_device, | ||
NonLinearity, np_to_torch, pad_to_last, | ||
prefer_gpu, product_of_gaussians, | ||
set_gpu_mode, soft_update_model, | ||
torch_to_np, TransposeImage, | ||
NonLinearity, output_height_2d, | ||
output_width_2d, pad_to_last, prefer_gpu, | ||
product_of_gaussians, set_gpu_mode, | ||
soft_update_model, torch_to_np, | ||
update_module_params) | ||
|
||
# yapf: enable | ||
__all__ = [ | ||
'compute_advantages', 'dict_np_to_torch', 'filter_valids', 'flatten_batch', | ||
'global_device', 'np_to_torch', 'pad_to_last', 'prefer_gpu', | ||
'compute_advantages', 'as_torch_dict', 'filter_valids', 'flatten_batch', | ||
'global_device', 'as_torch', 'pad_to_last', 'prefer_gpu', | ||
'product_of_gaussians', 'set_gpu_mode', 'soft_update_model', 'torch_to_np', | ||
'update_module_params', 'NonLinearity', 'flatten_to_single_vector', | ||
'TransposeImage' | ||
'output_width_2d', 'output_height_2d', 'expand_var' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.