(self, *inputs, **kwargs)
| 530 | self.module.float() |
| 531 | |
| 532 | def _create_cuda_graph(self, *inputs, **kwargs): |
| 533 | # warmup to create the workspace and cublas handle |
| 534 | cuda_stream = get_accelerator().Stream() |
| 535 | cuda_stream.wait_stream(get_accelerator().current_stream()) |
| 536 | with get_accelerator().stream(cuda_stream): |
| 537 | for i in range(3): |
| 538 | ret = self.module(*inputs, **kwargs) |
| 539 | get_accelerator().current_stream().wait_stream(cuda_stream) |
| 540 | |
| 541 | # create cuda_graph and assign static_inputs and static_outputs |
| 542 | self._cuda_graphs = torch.cuda.CUDAGraph() |
| 543 | self.static_inputs = inputs |
| 544 | self.static_kwargs = kwargs |
| 545 | |
| 546 | with torch.cuda.graph(self._cuda_graphs): |
| 547 | self.static_output = self.module(*self.static_inputs, **self.static_kwargs) |
| 548 | |
| 549 | self.cuda_graph_created = True |
| 550 | |
| 551 | def _graph_replay(self, *inputs, **kwargs): |
| 552 | for i in range(len(inputs)): |
no test coverage detected