Gravar-mail: Highly parallel simulation and optimization of photonic circuits in time and frequency domain based on the deep-learning framework PyTorch