Swift implementation of DNN.