MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetGraphs

Function GetGraphs

tensorflow/core/kernels/sdca_ops_test.cc:122–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void GetGraphs(const int32 num_examples, const int32 num_sparse_feature_groups,
123 const int32 sparse_features_per_group,
124 const int32 num_dense_feature_groups,
125 const int32 dense_features_per_group, Graph** const init_g,
126 Graph** train_g) {
127 {
128 // Build initialization graph
129 Graph* g = new Graph(OpRegistry::Global());
130
131 // These nodes have to be created first, and in the same way as the
132 // nodes in the graph below.
133 std::vector<Node*> sparse_weight_nodes =
134 VarVector(g, num_sparse_feature_groups, sparse_features_per_group);
135 std::vector<Node*> dense_weight_nodes =
136 VarVector(g, num_dense_feature_groups, dense_features_per_group);
137 Node* const multi_zero = Zeros(g, sparse_features_per_group);
138 for (Node* n : sparse_weight_nodes) {
139 test::graph::Assign(g, n, multi_zero);
140 }
141 Node* const zero = Zeros(g, dense_features_per_group);
142 for (Node* n : dense_weight_nodes) {
143 test::graph::Assign(g, n, zero);
144 }
145
146 *init_g = g;
147 }
148
149 {
150 // Build execution graph
151 Graph* g = new Graph(OpRegistry::Global());
152
153 // These nodes have to be created first, and in the same way as the
154 // nodes in the graph above.
155 std::vector<Node*> sparse_weight_nodes =
156 VarVector(g, num_sparse_feature_groups, sparse_features_per_group);
157 std::vector<Node*> dense_weight_nodes =
158 VarVector(g, num_dense_feature_groups, dense_features_per_group);
159
160 std::vector<NodeBuilder::NodeOut> sparse_indices;
161 std::vector<NodeBuilder::NodeOut> sparse_weights;
162 for (Node* n : sparse_weight_nodes) {
163 sparse_indices.push_back(
164 NodeBuilder::NodeOut(SparseIndices(g, sparse_features_per_group)));
165 sparse_weights.push_back(NodeBuilder::NodeOut(n));
166 }
167 std::vector<NodeBuilder::NodeOut> dense_weights;
168 dense_weights.reserve(dense_weight_nodes.size());
169 for (Node* n : dense_weight_nodes) {
170 dense_weights.push_back(NodeBuilder::NodeOut(n));
171 }
172
173 std::vector<NodeBuilder::NodeOut> sparse_example_indices;
174 std::vector<NodeBuilder::NodeOut> sparse_feature_indices;
175 std::vector<NodeBuilder::NodeOut> sparse_values;
176 sparse_example_indices.reserve(num_sparse_feature_groups);
177 for (int i = 0; i < num_sparse_feature_groups; ++i) {
178 sparse_example_indices.push_back(NodeBuilder::NodeOut(
179 SparseExampleIndices(g, sparse_features_per_group, num_examples)));

Callers 3

BM_SDCAFunction · 0.85
BM_SDCA_LARGE_DENSEFunction · 0.85
BM_SDCA_LARGE_SPARSEFunction · 0.85

Calls 15

VarVectorFunction · 0.85
SparseIndicesFunction · 0.85
SparseExampleIndicesFunction · 0.85
SparseFeatureIndicesFunction · 0.85
RandomZeroOrOneFunction · 0.85
RandomZeroOrOneMatrixFunction · 0.85
ZerosFunction · 0.70
AssignClass · 0.70
OnesFunction · 0.70
NodeOutClass · 0.50
TensorShapeClass · 0.50
NodeBuilderClass · 0.50

Tested by

no test coverage detected