Design by contract for deep learning APIs and models