Skip to content

Commit

Permalink
Bugfix/ci (#166)
Browse files Browse the repository at this point in the history
* fix reward clipping body outputing double instead of float

* linting
  • Loading branch information
cpnota committed Sep 25, 2020
1 parent 1d2cf9f commit 90dd2db
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion all/approximation/q_dist_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def _loss(dist, target_dist):
torch.sign(new_probs - original_probs), torch.sign(target_dists - 0.5)
)

# pylint: disable=bad-whitespace,bad-continuation
def test_project_dist(self):
# This gave problems in the past between different cuda version,
# so a test was added.
Expand Down
2 changes: 1 addition & 1 deletion all/bodies/rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ def process_state(self, state):
def _clip(self, reward):
if torch.is_tensor(reward):
return torch.sign(reward)
return np.sign(reward)
return float(np.sign(reward))
6 changes: 3 additions & 3 deletions all/nn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Dueling(nn.Module):
"""

def __init__(self, value_model, advantage_model):
super(Dueling, self).__init__()
super().__init__()
self.value_model = value_model
self.advantage_model = advantage_model
self.aggregation = Aggregation()
Expand All @@ -59,7 +59,7 @@ class CategoricalDueling(nn.Module):
"""Dueling architecture for C51/Rainbow"""

def __init__(self, value_model, advantage_model):
super(CategoricalDueling, self).__init__()
super().__init__()
self.value_model = value_model
self.advantage_model = advantage_model

Expand Down Expand Up @@ -98,7 +98,7 @@ class NoisyLinear(nn.Linear):
"""

def __init__(self, in_features, out_features, sigma_init=0.017, bias=True):
super(NoisyLinear, self).__init__(in_features, out_features, bias=bias)
super().__init__(in_features, out_features, bias=bias)
self.sigma_weight = nn.Parameter(
torch.Tensor(out_features, in_features).fill_(sigma_init)
)
Expand Down
2 changes: 1 addition & 1 deletion all/presets/atari/models/test_.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from all.environments import AtariEnvironment
from all.presets.atari.models import nature_rainbow

# pylint: disable=bad-whitespace,bad-continuation

class TestAtariModels(unittest.TestCase):
def setUp(self):
torch.manual_seed(0)
Expand Down

0 comments on commit 90dd2db

Please sign in to comment.