    def angular_diff_batch(a, b):
        """Angle difference from b to a (a - b) assumes the angles are not different by more than 2pi"""
        d = a - b
        d[d > math.pi] -= 2 * math.pi
        d[d < -math.pi] += 2 * math.pi
        return d
Angle difference from b to a (a - b) assumes the angles are not different by more than 2pi
examples/gym_pendulum_approximate.py