| 51 | } |
| 52 | |
| 53 | GraphNode* GraphSageEncoder(const std::string& encoder_name, |
| 54 | const std::vector<GroupConfigItem3>& items, |
| 55 | int depth, bool use_neigh_feat, bool sparse, |
| 56 | double relu_alpha, int dim) { |
| 57 | auto* Xnode_feat = |
| 58 | GetXInput(instance_name::X_NODE_FEATURE_NAME + encoder_name); |
| 59 | |
| 60 | GraphNode* next_hidden = nullptr; |
| 61 | if (use_neigh_feat) { |
| 62 | auto* Xneigh_feat = |
| 63 | GetXInput(instance_name::X_NEIGH_FEATURE_NAME + encoder_name); |
| 64 | bool is_act = depth > 0 ? true : false; |
| 65 | next_hidden = |
| 66 | SparseSageEncoder("SparseSageEncoder" + encoder_name, Xnode_feat, |
| 67 | Xneigh_feat, items, sparse, is_act, relu_alpha); |
| 68 | } else { |
| 69 | next_hidden = XInputGroupEmbeddingLookup("node_feature" + encoder_name, |
| 70 | Xnode_feat, items, sparse); |
| 71 | } |
| 72 | |
| 73 | const auto& self_blocks = |
| 74 | GetXBlockInputs(instance_name::X_SELF_BLOCK_NAME + encoder_name, depth); |
| 75 | const auto& neigh_blocks = |
| 76 | GetXBlockInputs(instance_name::X_NEIGH_BLOCK_NAME + encoder_name, depth); |
| 77 | for (int i = 0; i < depth; ++i) { |
| 78 | bool is_act = (i + 1) < depth ? true : false; |
| 79 | next_hidden = DenseSageEncoder( |
| 80 | encoder_name + "DenseSageEncoder" + std::to_string(i), next_hidden, |
| 81 | self_blocks[i], neigh_blocks[i], dim, is_act, relu_alpha); |
| 82 | } |
| 83 | return next_hidden; |
| 84 | } |
| 85 | |
| 86 | GraphNode* GraphSageEncoder(const std::string& encoder_name, |
| 87 | const std::vector<GroupConfigItem3>& items, |
no test coverage detected