.. index:: pair: struct; dnnl_graph_logical_tensor_t .. _doxid-structdnnl__graph__logical__tensor__t: struct dnnl_graph_logical_tensor_t ================================== .. toctree:: :hidden: Overview ~~~~~~~~ Logical tensor. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include struct dnnl_graph_logical_tensor_t { // fields size_t :ref:`id`; int :ref:`ndims`; :ref:`dnnl_dims_t` :ref:`dims`; :ref:`dnnl_data_type_t` :ref:`data_type`; :ref:`dnnl_graph_tensor_property_t` :ref:`property`; :ref:`dnnl_graph_layout_type_t` :ref:`layout_type`; :ref:`dnnl_dims_t` :ref:`strides`; size_t :ref:`layout_id`; union dnnl_graph_logical_tensor_t::@2 :target:`layout`; }; .. _details-structdnnl__graph__logical__tensor__t: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Logical tensor. It is based on an ID, a number of dimensions, dimensions themselves, element data type, tensor property and tensor memory layout. Fields ------ .. index:: pair: variable; id .. _doxid-structdnnl__graph__logical__tensor__t_1a35ea59fc96c5ac3bdab66f9cc8a43b14: .. ref-code-block:: cpp :class: doxyrest-title-code-block size_t id Unique id of each logical tensor. The library uses logical tensor IDs to build up the connections between operations if the output of one operation has the same ID as the input of another operation. .. index:: pair: variable; ndims .. _doxid-structdnnl__graph__logical__tensor__t_1a4afb34ddde9afec29db7e23835ecc7fd: .. ref-code-block:: cpp :class: doxyrest-title-code-block int ndims Number of dimensions. -1 means unknown (DNNL_GRAPH_UNKNOWN_NDIMS). 0 is used to define scalar tensor. .. index:: pair: variable; dims .. _doxid-structdnnl__graph__logical__tensor__t_1a9d92b96f039e80c2f72e1368613045fe: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_dims_t` dims Size of each dimension. :ref:`DNNL_GRAPH_UNKNOWN_DIM ` means the size of that dimension is unknown. 0 is used to define zero-dimension tensor. The library supports to deduce output shapes according to input shapes during compilation. Unlike memory descriptor in oneDNN primitive API, the order of dimensions is not defined in logical tensor. It is defined by the operations which respect the order through the attributes :ref:`dnnl_graph_op_attr_data_format ` or :ref:`dnnl_graph_op_attr_weights_format `. For example, for a Convolution with ``data_format=NXC``, it means the first element of dims of activation tensor is mini-batch size, the last effective element of dims is channel size, and other elements between them are spatial dimensions. .. index:: pair: variable; data_type .. _doxid-structdnnl__graph__logical__tensor__t_1a5828df15766e990f199060a2b28ca312: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_data_type_t` data_type Data type of the tensor elements. .. index:: pair: variable; property .. _doxid-structdnnl__graph__logical__tensor__t_1acc7672209797a339ccc09b8d6d10f6e6: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_graph_tensor_property_t` property Property type of the tensor. .. index:: pair: variable; layout_type .. _doxid-structdnnl__graph__logical__tensor__t_1a5e8dd6031f49c19cc2920e26c08f3be9: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_graph_layout_type_t` layout_type Layout type of the tensor. .. index:: pair: variable; strides .. _doxid-structdnnl__graph__logical__tensor__t_1a59d798e69e02e2f0012a75f6b6905471: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_dims_t` strides The field is valid when ``layout_type`` is :ref:`dnnl_graph_layout_type_strided `. :ref:`DNNL_GRAPH_UNKNOWN_DIM ` means the stride of the dimension is unknown. The library currently doesn't support other negative stride values. .. index:: pair: variable; layout_id .. _doxid-structdnnl__graph__logical__tensor__t_1af0fc868250dbefcd97d8e356c278bcdd: .. ref-code-block:: cpp :class: doxyrest-title-code-block size_t layout_id The field is valid when ``layout_type`` is :ref:`dnnl_graph_layout_type_opaque `. An opaque layout ID is usually generated by a partition which is compiled with layout type any.