Created by: xjqbest
- add fleet pslib pull and push sparse op and push dense op
- test=develop
why adding these ops: current embedding in pslib mode must be next to fluid.layers.data, nothing can be done between data and embedding, such as reshape or sampling, etc. And not to mention some complex operation on the calculation graph.
advantages: fleet_ctr_embedding and fleet_embedding is just a wrapper, the interface of fluid.layers.embedding does not change a bit.
usage:
for push dense op, it is added by fleet automatically. for sparse op, user only need to add a wrapper as following:
from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet_ctr_embedding, fleet_embedding
# when using fleet_ctr_embedding, default accessor is DownpourCtrAccessor,
# you can use config_fleet or fleet_desc_file to specify.
# user does not have to set fea_dim and embedx_dim in config_fleet
# ctr accessor, no click is specified, so user must use cvm layer
with fleet_ctr_embedding():
emb = fluid.layers.embedding(
input=var,
size=[-1, 11],
is_sparse=True,
is_distributed=True,
param_attr=fluid.ParamAttr(name="embedding"))
# ctr accessor, it's click name is label.name
with fleet_ctr_embedding(click=label.name):
emb = fluid.layers.embedding(
input=var,
size=[-1, 11],
is_sparse=True,
is_distributed=True,
param_attr=fluid.ParamAttr(name="embedding"))
# sparse value accessor
with fleet_embedding():
emb = fluid.layers.embedding(
input=var,
size=[-1, 11],
is_sparse=True,
is_distributed=True,
param_attr=fluid.ParamAttr(name="embedding"))