rnnlm.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:adaptiveSM 作者: OlivierShi 项目源码 文件源码
def __init__(self, n_input, n_hidden, n_batch, n_output, optimizer=sgd, p=0.5, use_adaptive_softmax=True):
        self.x = T.imatrix('batched_sequence_x')  # n_batch, maxlen
        self.x_mask = T.matrix('x_mask')
        self.y = T.imatrix('batched_sequence_y')
        self.y_mask = T.matrix('y_mask')

        self.n_input = n_input
        self.n_hidden = n_hidden
        self.n_output = n_output
        init_Embd = np.asarray(np.random.uniform(low=-np.sqrt(1. / n_output),
                                                 high=np.sqrt(1. / n_output),
                                                 size=(n_output, n_input)),
                               dtype=theano.config.floatX)
        self.E = theano.shared(value=init_Embd, name='word_embedding',borrow=True)

        self.optimizer = optimizer
        self.p = p
        self.is_train = T.iscalar('is_train')
        self.n_batch = n_batch
        self.epsilon = 1.0e-15
        self.rng = RandomStreams(1234)
        self.use_adaptive_softmax = use_adaptive_softmax
        self.build()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号