(self, g, aggregator='sum')
| 2192 | self.AddExternalOutput(*outputs) |
| 2193 | |
| 2194 | def DeduplicateGradientSlices(self, g, aggregator='sum'): |
| 2195 | assert isinstance(g, GradientSlice) |
| 2196 | unique, remapping = self.Unique([g.indices], 2, engine='SparseHash') |
| 2197 | if aggregator.lower() == 'sum': |
| 2198 | new_g = self.UnsortedSegmentSum([g.values, remapping], 1) |
| 2199 | elif aggregator.lower() == 'mean': |
| 2200 | new_g = self.UnsortedSegmentMean([g.values, remapping], 1) |
| 2201 | else: |
| 2202 | raise ValueError('{} is not supported'.format(aggregator)) |
| 2203 | return GradientSlice(indices=unique, values=new_g) |
| 2204 | |
| 2205 | @staticmethod |
| 2206 | def _RunAllOnGPU(net, gpu_id=0, use_cudnn=False): |
no test coverage detected