Reduce results from multiple cpus and distributes the results back to each device. This is done by copying values to cpu_0 and summing them. The cpu_0 result is then copied back to each of the devices. param: the name of the data (blobs) to reduce input_blob
(param, input_blobs, destination_blobs)
| 1982 | bias_grad_blobs = [] |
| 1983 | |
| 1984 | def _cpuReduce(param, input_blobs, destination_blobs): |
| 1985 | """ |
| 1986 | Reduce results from multiple cpus and distributes the results back |
| 1987 | to each device. This is done by copying values to cpu_0 and summing |
| 1988 | them. The cpu_0 result is then copied back to each of the devices. |
| 1989 | |
| 1990 | param: the name of the data (blobs) to reduce |
| 1991 | input_blobs: the list of blobs to reduce |
| 1992 | destination_blobs: list of blobs to copy the result to |
| 1993 | """ |
| 1994 | added_ops = [] |
| 1995 | result_blob = "cpu_0/" + param + "_combined" |
| 1996 | added_ops.append(core.CreateOperator("Sum", input_blobs, result_blob)) |
| 1997 | for blob in destination_blobs: |
| 1998 | added_ops.append(core.CreateOperator("Copy", result_blob, blob)) |
| 1999 | return added_ops |
| 2000 | |
| 2001 | for op in orig_ops: |
| 2002 | if op.type != 'SpatialBN' and op.type != 'SpatialBNGradient': |
no test coverage detected
searching dependent graphs…