Intel® oneAPI Deep Neural Network Developer Guide and Reference
A newer version of this document is available. Customers should click here to go to the newest version.
Tensor
Overview
Tensor is an abstraction for multi-dimensional input and output data needed in the execution of a compiled partition. More…
// typedefs
typedef struct dnnl_graph_tensor* dnnl_graph_tensor_t;
typedef const struct dnnl_graph_tensor* const_dnnl_graph_tensor_t;
// classes
class dnnl::graph::tensor;
// global functions
dnnl_status_t DNNL_API dnnl_graph_tensor_create(
    dnnl_graph_tensor_t* tensor,
    const dnnl_graph_logical_tensor_t* logical_tensor,
    dnnl_engine_t engine,
    void* handle
    );
dnnl_status_t DNNL_API dnnl_graph_tensor_destroy(dnnl_graph_tensor_t tensor);
dnnl_status_t DNNL_API dnnl_graph_tensor_get_data_handle(
    const_dnnl_graph_tensor_t tensor,
    void** handle
    );
dnnl_status_t DNNL_API dnnl_graph_tensor_set_data_handle(
    dnnl_graph_tensor_t tensor,
    void* handle
    );
dnnl_status_t DNNL_API dnnl_graph_tensor_get_engine(
    const_dnnl_graph_tensor_t tensor,
    dnnl_engine_t* engine
    );
dnnl_status_t DNNL_API dnnl_graph_tensor_get_logical_tensor(
    const_dnnl_graph_tensor_t tensor,
    dnnl_graph_logical_tensor_t* logical_tensor
    ); 
  Detailed Documentation
Tensor is an abstraction for multi-dimensional input and output data needed in the execution of a compiled partition.
A tensor object encapsulates a handle to a memory buffer allocated on a specific engine and a logical tensor which describes the dimensions, elements data type, and memory layout.
Typedefs
typedef struct dnnl_graph_tensor* dnnl_graph_tensor_t 
   A tensor handle.
typedef const struct dnnl_graph_tensor* const_dnnl_graph_tensor_t 
   A constant tensor handle.
Global Functions
dnnl_status_t DNNL_API dnnl_graph_tensor_create(
    dnnl_graph_tensor_t* tensor,
    const dnnl_graph_logical_tensor_t* logical_tensor,
    dnnl_engine_t engine,
    void* handle
    ) 
   Creates a tensor with logical tensor, engine, and data handle.
Parameters:
tensor  |  
        Output tensor.  |  
       
logical_tensor  |  
        Description for this tensor.  |  
       
engine  |  
        Engine to use.  |  
       
handle  |  
        Handle of the memory buffer to use as an underlying storage. 
  |  
       
Returns:
dnnl_success on success or a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_graph_tensor_destroy(dnnl_graph_tensor_t tensor) 
   Destroys a tensor.
Parameters:
tensor  |  
        The tensor to be destroyed.  |  
       
Returns:
dnnl_success on success or a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_graph_tensor_get_data_handle(
    const_dnnl_graph_tensor_t tensor,
    void** handle
    ) 
   Gets the data handle of a tensor.
Parameters:
tensor  |  
        The input tensor.  |  
       
handle  |  
        Pointer to the data of input tensor.  |  
       
Returns:
dnnl_success on success or a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_graph_tensor_set_data_handle(
    dnnl_graph_tensor_t tensor,
    void* handle
    ) 
   Set data handle for a tensor.
Parameters:
tensor  |  
        The input tensor.  |  
       
handle  |  
        New data handle for tensor.  |  
       
Returns:
dnnl_success on success or a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_graph_tensor_get_engine(
    const_dnnl_graph_tensor_t tensor,
    dnnl_engine_t* engine
    ) 
   Returns the engine of a tensor object.
Parameters:
tensor  |  
        The input tensor.  |  
       
engine  |  
        Output engine on which the tensor is located.  |  
       
Returns:
dnnl_success on success or a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_graph_tensor_get_logical_tensor(
    const_dnnl_graph_tensor_t tensor,
    dnnl_graph_logical_tensor_t* logical_tensor
    ) 
   Returns the logical tensor of a tensor object.
Parameters:
tensor  |  
        The input tensor.  |  
       
logical_tensor  |  
        Output logical tensor of the tensor object.  |  
       
Returns:
dnnl_success on success or a status describing the error otherwise.