/ input embedding lookup functions */ / rand initialization (-1 / log(col), 1 / log(col))
| 22 | /************************************************************************/ |
| 23 | // rand initialization (-1 / log(col), 1 / log(col)) |
| 24 | GraphNode* XInputEmbeddingLookup(const std::string& prefix, GraphNode* X, |
| 25 | const GroupConfigItem3& item, int sparse) { |
| 26 | DXCHECK_THROW(X->shape().is_rank(2)); |
| 27 | int tensor_type = sparse ? TENSOR_TYPE_SRM : TENSOR_TYPE_TSR; |
| 28 | int item_k = item.embedding_row + item.embedding_col; |
| 29 | auto* W = |
| 30 | GetVariable(prefix + "W", Shape(item.embedding_row, item.embedding_col), |
| 31 | tensor_type, TENSOR_INITIALIZER_TYPE_RAND, |
| 32 | -1.0 / std::log(item_k), 1.0 / std::log(item_k)); |
| 33 | return EmbeddingLookup("", X, W); |
| 34 | } |
| 35 | |
| 36 | // randn initialization (0, 1e-3) for graph-ctr models |
| 37 | GraphNode* XInputEmbeddingLookup2(const std::string& prefix, GraphNode* X, |