.. index:: pair: group; Tensor .. _doxid-group__dnnl__graph__api__tensor: Tensor ====== .. toctree:: :hidden: class_dnnl_graph_tensor.rst Overview ~~~~~~~~ Tensor is an abstraction for multi-dimensional input and output data needed in the execution of a compiled partition. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block // typedefs typedef struct dnnl_graph_tensor* :ref:`dnnl_graph_tensor_t`; typedef const struct dnnl_graph_tensor* :ref:`const_dnnl_graph_tensor_t`; // classes class :ref:`dnnl::graph::tensor`; // global functions :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_tensor_create`( :ref:`dnnl_graph_tensor_t`* tensor, const :ref:`dnnl_graph_logical_tensor_t`* logical_tensor, :ref:`dnnl_engine_t` engine, void* handle ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_tensor_destroy`(:ref:`dnnl_graph_tensor_t` tensor); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_tensor_get_data_handle`( :ref:`const_dnnl_graph_tensor_t` tensor, void** handle ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_tensor_set_data_handle`( :ref:`dnnl_graph_tensor_t` tensor, void* handle ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_tensor_get_engine`( :ref:`const_dnnl_graph_tensor_t` tensor, :ref:`dnnl_engine_t`* engine ); .. _details-group__dnnl__graph__api__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 -------- .. index:: pair: typedef; dnnl_graph_tensor_t .. _doxid-group__dnnl__graph__api__tensor_1ga77c7c6168286b2a791ecea37336d25d4: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct dnnl_graph_tensor* dnnl_graph_tensor_t A tensor handle. .. index:: pair: typedef; const_dnnl_graph_tensor_t .. _doxid-group__dnnl__graph__api__tensor_1ga501fef96950f38448cb326c776e8d068: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef const struct dnnl_graph_tensor* const_dnnl_graph_tensor_t A constant tensor handle. Global Functions ---------------- .. index:: pair: function; dnnl_graph_tensor_create .. _doxid-group__dnnl__graph__api__tensor_1gaf1ce44e7c73d38f7dfd2e4f374d341e5: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_tensor_create( :ref:`dnnl_graph_tensor_t`* tensor, const :ref:`dnnl_graph_logical_tensor_t`* logical_tensor, :ref:`dnnl_engine_t` engine, void* handle ) Creates a tensor with logical tensor, engine, and data handle. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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. * A pointer to the user-allocated buffer. In this case the library doesn't own the buffer. * The DNNL_MEMORY_ALLOCATE special value. Instructs the library to allocate the buffer for the tensor. In this case the library owns the buffer. * DNNL_MEMORY_NONE to create tensor without an underlying buffer. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_tensor_destroy .. _doxid-group__dnnl__graph__api__tensor_1ga42e42c1059fbb4f86919754d31c5888d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_tensor_destroy(:ref:`dnnl_graph_tensor_t` tensor) Destroys a tensor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tensor - The tensor to be destroyed. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_tensor_get_data_handle .. _doxid-group__dnnl__graph__api__tensor_1ga39f0b7ce6ba2067dc0a166075abebb16: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_tensor_get_data_handle( :ref:`const_dnnl_graph_tensor_t` tensor, void** handle ) Gets the data handle of a tensor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tensor - The input tensor. * - handle - Pointer to the data of input tensor. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_tensor_set_data_handle .. _doxid-group__dnnl__graph__api__tensor_1ga2b81562df6173e0f2ff1b4360c4cf3ec: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_tensor_set_data_handle( :ref:`dnnl_graph_tensor_t` tensor, void* handle ) Set data handle for a tensor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tensor - The input tensor. * - handle - New data handle for tensor. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_tensor_get_engine .. _doxid-group__dnnl__graph__api__tensor_1ga09d0a460550d1b399a0614c20663f73b: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_tensor_get_engine( :ref:`const_dnnl_graph_tensor_t` tensor, :ref:`dnnl_engine_t`* engine ) Returns the engine of a tensor object. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tensor - The input tensor. * - engine - Output engine on which the tensor is located. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise.