Beispiel #1
0
def reshape_observations_single_env(observations: np.array) -> Variable:
    """
    Reshape to channel first
    :param observations: (B, H, W, C) where B is the batch size
    :return: (B, C, H, W) observations
    """
    observations = observations.__array__().reshape(1, 84, 84, 4)
    return Variable(
        torch.from_numpy(observations.transpose((0, 3, 1, 2))).float() / 255.)