()
| 1141 | |
| 1142 | @staticmethod |
| 1143 | def _build_graph(): |
| 1144 | time.sleep(random.random() * 0.1) |
| 1145 | # Do some graph construction. Try to exercise non-trivial paths. |
| 1146 | graph = ops.get_default_graph() |
| 1147 | gdef = None |
| 1148 | for _ in range(10): |
| 1149 | x = array_ops.placeholder(dtype=dtypes.float32) |
| 1150 | with ops.colocate_with(x): |
| 1151 | y = array_ops.placeholder(dtype=dtypes.float32) |
| 1152 | with ops.device('/cpu:0'): |
| 1153 | z = control_flow_ops.while_loop( |
| 1154 | lambda x, y: x < 10, lambda x, y: (x + 1, x * y), [x, y]) |
| 1155 | with graph._attr_scope({'_a': attr_value_pb2.AttrValue(b=False)}): |
| 1156 | gradients_impl.gradients(z, [x, y]) |
| 1157 | if gdef is None: |
| 1158 | gdef = graph.as_graph_def() |
| 1159 | else: |
| 1160 | importer.import_graph_def(gdef, name='import') |
| 1161 | |
| 1162 | @test_util.run_v1_only('b/120545219') |
| 1163 | def testParallelRunAndSingleBuild(self): |
no test coverage detected