def METHOD_NAME(self, *inputs, **kwargs):
    # warmup to create the workspace and cublas handle
    cuda_stream = torch.cuda.Stream()
    cuda_stream.wait_stream(torch.cuda.current_stream())
    with torch.cuda.stream(cuda_stream):
        for i in range(3):
            ret = self._encode(*inputs, **kwargs)
    torch.cuda.current_stream().wait_stream(cuda_stream)
    # create cuda_graph and assign static_inputs and static_outputs
    self._encoder_cuda_graph = torch.cuda.CUDAGraph()
    self.static_encoder_inputs = inputs
    self.static_encoder_kwargs = kwargs
    with torch.cuda.graph(self._encoder_cuda_graph):
        self.static_encoder_output = self._encode(*self.static_encoder_inputs, **self.static_encoder_kwargs)
    self.encoder_cuda_graph_created = True