self.f = activation# word embeddingWe =init_weight(V, D)# linear termsW1 =init_weight(D, D) W2 =init_weight(D, D)# biasbh = np.zeros(D)# output layerWo =init_weight(D, K) bo = np.zeros(K)# make them tensorflow variablesself.We = tf.Variable(We.astype(np.float32)) self....
2. apply()函数用法:apply(func,*args,**kwargs)*args传入数据类型为元组,**kwargs传入数据类型为字典。当一个函数的参数存在于一个元组或者一个字典中时,用来间接的调用这个函数,并将元组或者字典中的参数按照顺序传递给参数e.g., self.encoder.apply(weight.init)ref: Python中的lambda和apply用法114 赞同 ...