()
| 30 | |
| 31 | |
| 32 | def example_task(): |
| 33 | with Task(): |
| 34 | with ops.task_init(): |
| 35 | one = ops.Const(1) |
| 36 | two = ops.Add([one, one]) |
| 37 | with ops.task_init(): |
| 38 | three = ops.Const(3) |
| 39 | accum = ops.Add([two, three]) |
| 40 | # here, accum should be 5 |
| 41 | with ops.task_exit(): |
| 42 | # here, accum should be 6, since this executes after lines below |
| 43 | seven_1 = ops.Add([accum, one]) |
| 44 | six = ops.Add([accum, one]) |
| 45 | ops.Add([accum, one], [accum]) |
| 46 | seven_2 = ops.Add([accum, one]) |
| 47 | o6 = final_output(six) |
| 48 | o7_1 = final_output(seven_1) |
| 49 | o7_2 = final_output(seven_2) |
| 50 | |
| 51 | with Task(num_instances=2): |
| 52 | with ops.task_init(): |
| 53 | one = ops.Const(1) |
| 54 | with ops.task_instance_init(): |
| 55 | local = ops.Const(2) |
| 56 | ops.Add([one, local], [one]) |
| 57 | ops.LogInfo('ble') |
| 58 | |
| 59 | return o6, o7_1, o7_2 |
| 60 | |
| 61 | def example_job(): |
| 62 | with Job() as job: |
no test coverage detected
searching dependent graphs…