A flexible and fast PyTorch toolkit for simulating training and inference on analog crossbar arrays