warp.capture_load_from_bytes#
- warp.capture_load_from_bytes(data, modules=None, device=None)[source]#
Load a serialized graph from in-memory bytes.
dataholds the contents of a.wrpfile written bycapture_save(), andmodulesholds the contents of the files in its companion<stem>_modules/directory. The returned graph behaves the same as one returned bycapture_load(). Warp copies everything it needs while loading, so the caller may release the buffers once this returns.- Parameters:
data – The
.wrpfile contents as a bytes-like object, such asbytes,bytearray,memoryview, or a C-contiguous NumPy array.modules (Mapping[str, Any] | None) – Maps each module filename written to
<stem>_modules/bycapture_save(), without a directory prefix, to the file’s contents as a bytes-like object. Entries the graph does not use are ignored. May be omitted when the graph launches no kernels.device (Device | str | None) – The device to load the graph onto. Must have the same device family (CPU or CUDA) as the saved graph.
- Returns:
A
Graphobject that can be launched withcapture_launch().- Raises:
TypeError – If
dataor a module’s contents are not bytes-like,modulesis not a mapping, or a module name is not a string.ValueError – If
dataor a module’s contents are not a C-contiguous buffer.RuntimeError – If
datais malformed, or a module the graph uses is missing or fails to load.
- Return type: