(self, dtype=core.DataType.FLOAT)
| 69 | |
| 70 | @unittest.skipIf(not workspace.has_gpu_support, "No gpu support") |
| 71 | def testGPUDense(self, dtype=core.DataType.FLOAT): |
| 72 | device_opt = core.DeviceOption(workspace.GpuDeviceType, 0) |
| 73 | with core.DeviceScope(device_opt): |
| 74 | model, _perfect_model, data, label = self._createDense(dtype) |
| 75 | if dtype == core.DataType.FLOAT16: |
| 76 | fc_fp32_for_host = model.HalfToFloat('fc', 'fc_fp32_for_host') |
| 77 | model.CopyGPUToCPU(fc_fp32_for_host, 'fc_cpu') |
| 78 | else: |
| 79 | model.CopyGPUToCPU('fc', 'fc_cpu') |
| 80 | workspace.FeedBlob('data', data[0]) |
| 81 | workspace.FeedBlob('label', label[0]) |
| 82 | |
| 83 | # Add some CPU ops |
| 84 | brew.fc(model, 'fc_cpu', 'fc2', dim_in=1, dim_out=10, axis=0) |
| 85 | |
| 86 | # Create optimizer in default device scope |
| 87 | self.build_optimizer(model) |
| 88 | |
| 89 | if self._skip_gpu: |
| 90 | return |
| 91 | |
| 92 | # Run net to see it does not crash |
| 93 | workspace.RunNetOnce(model.param_init_net) |
| 94 | workspace.CreateNet(model.net, True) |
| 95 | workspace.RunNet(model.net.Proto().name) |
| 96 | |
| 97 | def testSparse(self): |
| 98 | # to test duplicated indices we assign two indices to each weight and |
nothing calls this directly
no test coverage detected