# tensorplay.cuda.graphs.graph Source: https://www.tensorplay.cn/docs/generated/tensorplay.cuda.graphs.graph.html ```python tensorplay.cuda.graphs.graph(cuda_graph, pool=None, stream=None, capture_error_mode='global') ``` Context-manager that captures CUDA work into a tensorplay.cuda.CUDAGraph. Parameters: - cuda_graph ([CUDAGraph](/docs/generated/tensorplay.cuda.graphs.CUDAGraph.html#tensorplay.cuda.graphs.CUDAGraph)) – the graph object to capture into. - pool – None gives the graph its own private memory pool; an id from [graph_pool_handle()](/docs/generated/tensorplay.cuda.graphs.graph_pool_handle.html#tensorplay.cuda.graphs.graph_pool_handle) (or another graph / its pool_id property) shares that pool so allocations from both captures can recycle each other’s space. - stream ([Stream](/docs/generated/tensorplay.cuda.streams.Stream.html#tensorplay.cuda.streams.Stream), optional) – custom capture stream; defaults to the runtime’s dedicated per-device side stream (the legacy default stream cannot capture). - capture_error_mode ([str](https://docs.python.org/3/builtins/stdtypes.html#str), optional) – see [CUDAGraph.capture_begin()](/docs/generated/tensorplay.cuda.graphs.CUDAGraph.html#tensorplay.cuda.graphs.CUDAGraph.capture_begin).