From 2917a75b7a5dccde79d67a5493d7d8f5319f85cb Mon Sep 17 00:00:00 2001 From: Yancey1989 Date: Wed, 18 Apr 2018 11:41:25 +0800 Subject: [PATCH] add some comments for sparse table --- paddle/fluid/framework/selected_rows.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/paddle/fluid/framework/selected_rows.h b/paddle/fluid/framework/selected_rows.h index df580c3a145..a6e96872515 100644 --- a/paddle/fluid/framework/selected_rows.h +++ b/paddle/fluid/framework/selected_rows.h @@ -24,6 +24,22 @@ namespace paddle { namespace framework { class SelectedRows { + /* + * @brief We can use the SelectedRows structure to reproduce a sparse table. + * A sparse table is a key-value structure that the key is an `int64_t` + * number, + * and the value is a Tensor which the first dimension is 0. + * You can use the following interface to operate the sparse table, and you + * can find + * some detail information from the comments of each interface: + * + * HasKey(key), whether the sparse table has the specified key. + * Set(key, value), set a key-value pair into the sparse table. + * Get(key, value*, offset), get a value by key and apply it to the given + * value pointer + * with the specified offset. + * + */ public: SelectedRows(const std::vector& rows, const int64_t& height) : rows_(rows), height_(height) { -- GitLab