Skip to content

Commit 1372e91

Browse files
committed
Asserts are not needed anymore
1 parent a07bb1b commit 1372e91

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

sb3_contrib/common/maskable/distributions.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,15 @@ def proba_distribution(
138138
return self
139139

140140
def log_prob(self, actions: th.Tensor) -> th.Tensor:
141-
assert self.distribution is not None, "Must set distribution parameters"
142141
return self.distribution.log_prob(actions)
143142

144143
def entropy(self) -> th.Tensor:
145-
assert self.distribution is not None, "Must set distribution parameters"
146144
return self.distribution.entropy()
147145

148146
def sample(self) -> th.Tensor:
149-
assert self.distribution is not None, "Must set distribution parameters"
150147
return self.distribution.sample()
151148

152149
def mode(self) -> th.Tensor:
153-
assert self.distribution is not None, "Must set distribution parameters"
154150
return th.argmax(self.distribution.probs, dim=1)
155151

156152
def actions_from_params(self, action_logits: th.Tensor, deterministic: bool = False) -> th.Tensor:
@@ -164,7 +160,6 @@ def log_prob_from_params(self, action_logits: th.Tensor) -> tuple[th.Tensor, th.
164160
return actions, log_prob
165161

166162
def apply_masking(self, masks: MaybeMasks) -> None:
167-
assert self.distribution is not None, "Must set distribution parameters"
168163
self.distribution.apply_masking(masks)
169164

170165

0 commit comments

Comments
 (0)