From 4db7c546f4dcdec614ef83de6686272041ef603d Mon Sep 17 00:00:00 2001 From: Helin Wang Date: Tue, 16 May 2017 16:55:02 -0400 Subject: [PATCH] add documentation for client --- paddle/go/pserver/client.go | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/paddle/go/pserver/client.go b/paddle/go/pserver/client.go index 04bf58cd3e2..5b110af648d 100644 --- a/paddle/go/pserver/client.go +++ b/paddle/go/pserver/client.go @@ -13,49 +13,71 @@ const ( Float64 ) +// Parameter is a piece of data to sync with the parameter server. type Parameter struct { Name string ElementType ElementType Content []byte } +// ParameterWithConfig contains the parameter and the configuration. type ParameterWithConfig struct { Param Parameter - Config []byte + Config []byte // parameter configuration in Proto Buffer format } +// Gradient is the gradient of the parameter. type Gradient Parameter +// Client is the client to parameter servers. type Client struct { } +// NewClient creates a new client. func NewClient(addr string) *Client { return &Client{} } -func (c *Client) BeginInitParams(pserverConfigProto []byte) (bool, error) { +// BeginInitParams begins to initialize parameters on parameter +// servers. +// +// BeginInitParams will be called from multiple trainers, only one +// trainer will be selected to initialize the parameters on parameter +// servers. Other trainers will be blocked until the initialization is +// done, and they need to get the initialized parameters from +// parameter servers using GetParams. +func (c *Client) BeginInitParams(pserverConfigProto []byte) (selected bool, err error) { return true, nil } +// InitParam initializes the parameter on parameter servers. func (c *Client) InitParam(paramWithConfigs ParameterWithConfig) error { return nil } +// FinishInitParams tells parameter servers client has sent all +// parameters to parameter servers as initialization. func (c *Client) FinishInitParams() error { return nil } +// SendGrads sends gradients to parameter servers for updating +// parameters. func (c *Client) SendGrads(grads []Gradient) error { return nil } +// GetParams gets parameters from parameter servers. func (c *Client) GetParams(names []string) ([]Parameter, error) { return nil, nil } +// SaveModel indicates parameters to save the parameter to the given +// path. func (c *Client) SaveModel(path string) error { return nil } +// Cleanup cleans up the client states. func (c *Client) Cleanup() { } -- GitLab