def __init__(self, dset, hps, opt_hps, train=True, opt='nag'): super(RNN, self).__init__(dset, hps, train=train) self.nl = get_nl(hps.nl) self.alloc_params() self.alloc_grads() if train: self.opt = create_optimizer(opt, self, **(opt_hps.to_dict()))
def __init__(self, dset, hps, opt_hps, train=True, opt='nag'): super(NNJM, self).__init__(dset, hps, train=train) self.ctc_loader = CTCLoader(SOURCE_CONTEXT*NUM_CHARS, dset.batch_size, dset.subset) self.nl = get_nl(hps.nl) self.alloc_params() if train: self.opt = create_optimizer(opt, self, alpha=opt_hps.alpha, mom=opt_hps.mom, mom_low=opt_hps.mom_low, low_mom_iters=opt_hps.low_mom_iters)