einsums::compute_graph::CaptureGuard#
Note
Generated from the C++ headers by apiary --emit-cpp-docs-json.
Defined in header Einsums/ComputeGraph/CaptureContext.hpp.
-
class CaptureGuard#
RAII guard for graph capture.
Creates a capture scope: operations called between construction and destruction are recorded into the graph instead of executing immediately.
Example
cg::Graph graph("example"); { cg::CaptureGuard guard(graph); cg::einsum(...); // Recorded, not executed cg::scale(...); // Recorded, not executed } // guard destroyed → capture ends, graph is topologically sorted graph.execute(); // NOW the operations runNote
Not copyable or movable. Nested captures are not supported.
See also
CaptureContext for the underlying state machine
-
explicit CaptureGuard(Graph &g)#
Begin capturing operations into the given graph.
- Parameters:
g – The graph to capture into.
-
CaptureGuard(const CaptureGuard&) = delete#
-
CaptureGuard(CaptureGuard&&) = delete#
-
~CaptureGuard()#
End capture and finalize the graph. Swallows exceptions: a throwing destructor would call
std::terminateif we were unwinding from a captured op that itself threw. Callers who want to see finalization errors should callend_capture()explicitly.
-
CaptureGuard &operator=(const CaptureGuard&) = delete#
-
CaptureGuard &operator=(CaptureGuard&&) = delete#
-
explicit CaptureGuard(Graph &g)#