A former Avon and Somerset Police officer has been sentenced after admitting a charge of stalking without fear of violence.