tensorflow/core/kernels/constant_op_test.cc
// Returns graph containing "num" const nodes.  If 'sequential' is
// true, make sure all constants are executed sequentially in the
// graph by adding control dependencies.
Returns graph containing "num" const nodes.  If 'sequential' is
true, make sure all constants are executed sequentially in the
graph by adding control dependencies.
Returns graph containing " num " const nodes . If ' sequential ' is true make sure all constants are executed sequentially in the graph by adding control dependencies .
static Graph* ManyConsts(int num, bool sequential) {
  Graph* g = new Graph(OpRegistry::Global());
  Node* prev = nullptr;
  for (int i = 0; i < num; ++i) {
    Tensor c(DT_FLOAT, TensorShape({}));
    c.scalar<float>()() = i;
    Node* curr = test::graph::Constant(g, c);
    if (sequential && prev != nullptr) {
      g->AddControlEdge(prev, curr);
    }
    prev = curr;
  }
  return g;
}
static Graph * ManyConsts ( int num , bool sequential ) { Graph * g = new Graph ( OpRegistry :: Global ( ) ) ; Node * prev = nullptr ; for ( int i = 0 ; i < num ; ++ i ) { Tensor c ( DT_FLOAT , TensorShape ( { } ) ) ; c . scalar < float > ( ) ( ) = i ; Node * curr = test :: graph :: Constant ( g , c ) ; if ( sequential && prev != nullptr ) { g -> AddControlEdge ( prev , curr ) ; } prev = curr ; } return g ; }
Returns graph containing "num" const nodes.
Returns graph containing " num " const nodes .