| 75 | } |
| 76 | |
| 77 | NodeDef BuildNode( |
| 78 | const std::string& op, |
| 79 | const std::vector<std::initializer_list<int>>& output_shapes) { |
| 80 | NodeDef node; |
| 81 | node.set_op(op); |
| 82 | node.set_name("Node1"); |
| 83 | node.add_input(); |
| 84 | node.set_input(0, "Node0"); |
| 85 | |
| 86 | AttrValue::ListValue* shapes = |
| 87 | (*node.mutable_attr())["_output_shapes"].mutable_list(); |
| 88 | for (const auto& output_shape : output_shapes) { |
| 89 | tensorflow::TensorShapeProto* shape = shapes->add_shape(); |
| 90 | for (int64_t output_shape_dim : output_shape) { |
| 91 | auto shape_dim = shape->add_dim(); |
| 92 | shape_dim->set_size(output_shape_dim); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | return node; |
| 97 | } |
| 98 | |
| 99 | namespace { |
| 100 | void BuildConstNode(std::initializer_list<int64_t> shape, |