Algorithmic differentiation for coupled FEniCS and PyTorch models