mirror of
https://github.com/gryf/coach.git
synced 2025-12-18 11:40:18 +01:00
add meaningful error message in the event that the action space is not one that can be used (#151)
This commit is contained in:
committed by
Gal Leibovich
parent
f12857a8c7
commit
d0248e03c6
@@ -34,6 +34,12 @@ class QHead(Head):
|
|||||||
self.num_actions = 1
|
self.num_actions = 1
|
||||||
elif isinstance(self.spaces.action, DiscreteActionSpace):
|
elif isinstance(self.spaces.action, DiscreteActionSpace):
|
||||||
self.num_actions = len(self.spaces.action.actions)
|
self.num_actions = len(self.spaces.action.actions)
|
||||||
|
else:
|
||||||
|
raise ValueError(
|
||||||
|
'QHead does not support action spaces of type: {class_name}'.format(
|
||||||
|
class_name=self.spaces.action.__class__.__name__,
|
||||||
|
)
|
||||||
|
)
|
||||||
self.return_type = QActionStateValue
|
self.return_type = QActionStateValue
|
||||||
if agent_parameters.network_wrappers[self.network_name].replace_mse_with_huber_loss:
|
if agent_parameters.network_wrappers[self.network_name].replace_mse_with_huber_loss:
|
||||||
self.loss_type = tf.losses.huber_loss
|
self.loss_type = tf.losses.huber_loss
|
||||||
@@ -49,5 +55,3 @@ class QHead(Head):
|
|||||||
"Dense (num outputs = {})".format(self.num_actions)
|
"Dense (num outputs = {})".format(self.num_actions)
|
||||||
]
|
]
|
||||||
return '\n'.join(result)
|
return '\n'.join(result)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user