NTM Swift implementation based on [ http://arxiv.org/abs/1410.5401 ]