PaddlePaddle / models

Officially maintained, supported by PaddlePaddle, including CV, NLP, Speech, Rec, TS, big models and so on.
Apache License 2.0
6.9k stars 2.91k forks source link

why word2vec stop_gradient #3313

Open liusilver1116 opened 5 years ago

liusilver1116 commented 5 years ago

word2vec 代码中这一行 不太明白 neg_word_reshape.stop_gradient = True

data层本来stop_gradient默认参数就是True, 为什么还要设置一下? paddle.fluid.layers.data(name, shape, append_batch_size=True, dtype='float32', lod_level=0, type=VarType.LOD_TENSOR, stop_gradient=True)

JiabinYang commented 5 years ago

因为过了reshape之后会将stop_gradient的属性修改为false