(self, tag, add_prefix=True, reduce_across=None, device_id=-1)
| 148 | workspace.FeedBlob(tag, val) |
| 149 | |
| 150 | def FetchBlobWrapper(self, tag, add_prefix=True, reduce_across=None, device_id=-1): |
| 151 | if self.ndevices > 1 and add_prefix: |
| 152 | # fetch from multiple devices |
| 153 | vals = [] |
| 154 | for d in range(self.ndevices): |
| 155 | if tag.__class__ == list: |
| 156 | tag_on_device = tag[d] |
| 157 | else: |
| 158 | tag_on_device = "gpu_" + str(0) + "/" + tag |
| 159 | val = workspace.FetchBlob(tag_on_device) |
| 160 | vals.append(val) |
| 161 | # reduce across devices |
| 162 | if reduce_across == "add": |
| 163 | return functools.reduce(operator.add, vals) |
| 164 | elif reduce_across == "concat": |
| 165 | return np.concatenate(vals) |
| 166 | else: |
| 167 | return vals |
| 168 | else: |
| 169 | # fetch from a single device (named or not) |
| 170 | if device_id >= 0: |
| 171 | tag_on_device = "gpu_" + str(device_id) + "/" + tag |
| 172 | return workspace.FetchBlob(tag_on_device) |
| 173 | else: |
| 174 | return workspace.FetchBlob(tag) |
| 175 | |
| 176 | def AddLayerWrapper( |
| 177 | self, layer, inp_blobs, out_blobs, add_prefix=True, reset_grad=False, **kwargs |
no outgoing calls
no test coverage detected