Skip to main content

import

Function import 

Source
pub fn import(blob: &[u8], fds: &[RawFd]) -> Result<TensorDyn>
Expand description

Reconstruct a tensor from a blob.

Import dups every fd it retains, so the result is fully independent and the source tensor may die immediately. In inline mode the result is a new allocation holding a copy of the carried bytes.

fds is the table that travelled beside the blob; a reference-mode plane’s handle indexes into it. Pass an empty slice for an inline blob.

blob is untrusted: it may come from another wheel, another process, or a network. Every length has already been bounded by BlobView::parse; this function adds the semantic checks that parsing alone cannot make, and every index is bounded against fds before use.