You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am implementing Wumpus World in Tensorflow using DQN with discrete action space and encounter following error while trying to collect data using greedy policy tensorflow.python.framework.errors_impl.InvalidArgumentError: 'then' and 'else' must have the same size. but received: [1,1] vs. [1] [Op:Select]
raised by this line in EpsilonGreedyPolicy action = tf.compat.v1.where(cond, greedy_action.action, random_action.action)
I reckon this is the same issue as in #255 and #253 but applying workarounds mentioned there to RandomTFPolicy does not work and the error still remains the same. However, when I change network which I am using from:
class QNetwork(q_network.QNetwork):
def __init__(self, input_tensor_spec, action_spec, num_actions, name=None):
super(QNetwork, self).__init__(
input_tensor_spec=input_tensor_spec,
action_spec=action_spec,
name=name)
self._sub_layers = [
tf.keras.layers.Dense(num_actions),
]
def call(self, inputs, step_type=None, network_state=(), **kwargs):
del step_type
inputs = tf.cast(inputs, tf.float32)
for layer in self._sub_layers:
inputs = layer(inputs)
return inputs, network_state
then the exception is not raised. Of course such network is not what I am looking for to base my agent's policy on, so I would be very thankful for any suggestions what might be wrong in my code.
The text was updated successfully, but these errors were encountered:
I am implementing Wumpus World in Tensorflow using DQN with discrete action space and encounter following error while trying to collect data using greedy policy
tensorflow.python.framework.errors_impl.InvalidArgumentError: 'then' and 'else' must have the same size. but received: [1,1] vs. [1] [Op:Select]
raised by this line in EpsilonGreedyPolicy
action = tf.compat.v1.where(cond, greedy_action.action, random_action.action)
I reckon this is the same issue as in #255 and #253 but applying workarounds mentioned there to RandomTFPolicy does not work and the error still remains the same. However, when I change network which I am using from:
to simply:
then the exception is not raised. Of course such network is not what I am looking for to base my agent's policy on, so I would be very thankful for any suggestions what might be wrong in my code.
The text was updated successfully, but these errors were encountered: