Fix GPU compat, Question on NN __init__ #6
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Section 1 of 2
When GPU is on,
assert isinstance(x, torch.FloatTensor)
will fail since GPU tensors are nottorch.FloatTensor
.This is fixed by adding:
self.check_input_data_into_forward_once(x.cpu())
However, perhaps it would be better to try:
assert isinstance(x.cpu(), torch.FloatTensor)
?Section 2 of 2
There are parameter conflicts during initialization.
Note in https://github.com/p-christ/Deep-Reinforcement-Learning-Algorithms-with-PyTorch/blob/80c09bdac501af3bc47d74901ceadd2f778cf3cb/agents/Base_Agent.py#L310 the initialization is:
However the current initialization is:
Two issues:
So we can either:
a. Change Deep-Reinforcement-Learning-Algorithms-with-PyTorch code to match this
b. Change this to match Deep-Reinforcement-Learning-Algorithms-with-PyTorch.
Currently I changed a little bit of both, however I like how Deep-Reinforcement-Learning-Algorithms-with-PyTorch natively inputs layer information. I guess I am currious about the rational behind the differences between the 2. Based on your response, I might change this to better match Deep-Reinforcement-Learning-Algorithms-with-PyTorch's usage of this library. I like having a parameter for input, hidden, and output separate.
One advantage of a single input "layer_info" might be the greater flexibility of different layers. Possibly supporting list, or dictionary inputs in the future.