Preallocated CUDA (Local RAM)

Description

Execute the model using CPU input data and pre-allocated CUDA output buffers. Type : polymorphic.
Warning : This function can only be executed with CUDA or TensorRT.
The session execution writes the results directly into the provided GPU output pointers, which must be allocated and managed by the user.

 

 

Input parameters

 

Β Inference inΒ :Β object,Β inference session.

Β Data in :Β array,Β is an array of clusters, where each cluster represents a single model input. Each cluster contains metadata and raw data required to describe and pass an input tensor to the model.

Β input_order :Β integer,Β defines the position of the input within the data array. It corresponds to the index assigned to the input when it is created (via theΒ indexΒ parameter).
Β Inputs Info :Β cluster

Β inputs_data :Β array,Β contains the raw byte representation of the input tensor data, stored as a 1D flattened buffer.
Β 
inputs_shapes :Β array,Β 
specifies the shape of the input tensor. Since the data is stored as a flattened 1D buffer, this shape is necessary to reconstruct the original dimensions.
Β 
inputs string length :Β array,Β 
used when the tensor type is string. If the tensor has shapeΒ [5,3], this field contains 15 values, each representing the length of a corresponding string element. This ensures that the actual size ofΒ inputs_dataΒ is known despite variable string lengths.
Β 
inputs_ranks :Β array,Β 
indicates the rank of the tensor, i.e. the number of dimensions (Scalar = 0, 1D = 1, 2D = 2, etc.).
Β 
inputs_types :Β array,Β 
defines the ONNX tensor type as an enumerated value (e.g. FLOAT, INT64, STRING).

​

Β Data out : array,

Β output_order : integer, defines the position of the output within the data array. It corresponds to the index assigned to the output when it is created (via the index parameter).
Β Outputs Info : cluster

Β outputs_ptr : integer, contains the raw byte representation of the input tensor data, stored as a 1D flattened buffer.
Β 
outputs_shapes :Β array,Β 
specifies the shape of the output tensor. Since the data is written into a pre-allocated device buffer, this shape allows the runtime to interpret the memory layout correctly.
Β 
outputs_ranks : integer,
indicates the rank of the tensor, i.e. the number of dimensions (Scalar = 0, 1D = 1, 2D = 2, etc.).
Β 
outputs_types : enum,
defines the ONNX tensor type as an enumerated value (e.g. FLOAT, INT64, STRING).

​

Output parameters

 

Β Inference outΒ :Β object,Β inference session.

Example

All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install Accelerator library to run it).

Table of Contents