quantization of word embedding
Created by: wanghaoshuang
thres = 0.01
110 word = np.array(fluid.global_scope().find_var("word_embedding").get_tensor())
111 word[abs(word)>thres] = 0
112 tmp = np.log(np.abs(word) + 1)
113 max_range = np.max(tmp)
114 tmp = np.floor(127*tmp/max_range)
115 word = (np.exp(tmp * max_range / 127)-1) * np.sign(word)
116 fluid.global_scope().find_var("word_embedding").get_tensor().set(word, place)
117 logger.info("------------------quan done-------------------")