rand initiialization (-1 / col, 1 / col)
| 46 | |
| 47 | // rand initiialization (-1 / col, 1 / col) |
| 48 | GraphNode* XInputEmbeddingLookup3(const std::string& prefix, GraphNode* X, |
| 49 | const GroupConfigItem3& item, int sparse) { |
| 50 | DXCHECK_THROW(X->shape().is_rank(2)); |
| 51 | int tensor_type = sparse ? TENSOR_TYPE_SRM : TENSOR_TYPE_TSR; |
| 52 | auto* W = |
| 53 | GetVariable(prefix + "W", Shape(item.embedding_row, item.embedding_col), |
| 54 | tensor_type, TENSOR_INITIALIZER_TYPE_RAND, |
| 55 | -1.0 / item.embedding_col, 1.0 / item.embedding_col); |
| 56 | return EmbeddingLookup("", X, W); |
| 57 | } |
| 58 | |
| 59 | /************************************************************************/ |
| 60 | /* output embedding lookup functions */ |