self.action_space, self.model.model_config))
// Add a batch dimension.
if len(action_dist.inputs.shape) == len(req) + 1:
a = np.expand_dims(a, 0)
action = torch.from_numpy(a).to(self.device)
else:
action = action_dist.deterministic_sample()
logp = torch.zeros(
After Change
// Add a batch dimension?
if len(action_dist.inputs.shape) == len(req) + 1:
batch_size = action_dist.inputs.shape[0]
a = np.stack(
[self.action_space.sample() for _ in range(batch_size)])
else:
a = self.action_space.sample()
// Convert action to torch tensor.
action = torch.from_numpy(a).to(self.device)