.. index:: pair: group; Op .. _doxid-group__dnnl__graph__api__op: Op == .. toctree:: :hidden: enum_dnnl_graph_op_attr_t.rst enum_dnnl_graph_op_kind_t.rst class_dnnl_graph_op.rst Overview ~~~~~~~~ OP is an abstraction of computation logic for deep neural network operations. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block // typedefs typedef struct dnnl_graph_op* :ref:`dnnl_graph_op_t`; typedef const struct dnnl_graph_op* :ref:`const_dnnl_graph_op_t`; // enums enum :ref:`dnnl_graph_op_attr_t`; enum :ref:`dnnl_graph_op_kind_t`; // classes class :ref:`dnnl::graph::op`; // global functions :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_create`( :ref:`dnnl_graph_op_t`* op, size_t id, :ref:`dnnl_graph_op_kind_t` kind, const char* verbose_name ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_destroy`(:ref:`dnnl_graph_op_t` op); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_add_input`( :ref:`dnnl_graph_op_t` op, const :ref:`dnnl_graph_logical_tensor_t`* input ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_add_output`( :ref:`dnnl_graph_op_t` op, const :ref:`dnnl_graph_logical_tensor_t`* output ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_set_attr_f32`( :ref:`dnnl_graph_op_t` op, :ref:`dnnl_graph_op_attr_t` name, const float* value, size_t value_len ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_set_attr_bool`( :ref:`dnnl_graph_op_t` op, :ref:`dnnl_graph_op_attr_t` name, const uint8_t* value, size_t value_len ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_set_attr_s64`( :ref:`dnnl_graph_op_t` op, :ref:`dnnl_graph_op_attr_t` name, const int64_t* value, size_t value_len ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_set_attr_str`( :ref:`dnnl_graph_op_t` op, :ref:`dnnl_graph_op_attr_t` name, const char* value, size_t value_len ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_get_id`( :ref:`const_dnnl_graph_op_t` op, size_t* id ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_op_get_kind`( :ref:`const_dnnl_graph_op_t` op, :ref:`dnnl_graph_op_kind_t`* kind ); .. _details-group__dnnl__graph__api__op: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ OP is an abstraction of computation logic for deep neural network operations. An op object encapsulates an operation kind which describes the computation logic, an unique ID which differentiates operations with the same kind, and logical tensors which describes the input and output of the operation and its connections to other operations in the graph. Typedefs -------- .. index:: pair: typedef; dnnl_graph_op_t .. _doxid-group__dnnl__graph__api__op_1ga7a26d33507389facd89c77a7bd042834: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct dnnl_graph_op* dnnl_graph_op_t An operation handle. .. index:: pair: typedef; const_dnnl_graph_op_t .. _doxid-group__dnnl__graph__api__op_1gad7b0799ea1aec4c3544f0a155f8d192b: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef const struct dnnl_graph_op* const_dnnl_graph_op_t A constant operation handle. Global Functions ---------------- .. index:: pair: function; dnnl_graph_op_create .. _doxid-group__dnnl__graph__api__op_1ga89f9449ddd533e166e3deaf253520ba1: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_create( :ref:`dnnl_graph_op_t`* op, size_t id, :ref:`dnnl_graph_op_kind_t` kind, const char* verbose_name ) Initializes an op with unique id, kind, and name. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - Output op * - id - The unique id of the output op. * - kind - The op kind. * - verbose_name - The string added as the op name. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_op_destroy .. _doxid-group__dnnl__graph__api__op_1ga9078b97ce5f2e44cb318d08ff96fe391: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_destroy(:ref:`dnnl_graph_op_t` op) Destroys an op. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - The op to be destroyed. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_op_add_input .. _doxid-group__dnnl__graph__api__op_1gac1cc01522c2328069e8bd045f563554f: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_add_input( :ref:`dnnl_graph_op_t` op, const :ref:`dnnl_graph_logical_tensor_t`* input ) Adds input logical tensor to the op. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - Input op. * - input - The input logical tensor to be added. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_op_add_output .. _doxid-group__dnnl__graph__api__op_1gad2ada5d285eb5cc8aa38785585525b3d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_add_output( :ref:`dnnl_graph_op_t` op, const :ref:`dnnl_graph_logical_tensor_t`* output ) Adds output logical tensor to the op. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - Input op. * - output - The output logical tensor to be added. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_op_set_attr_f32 .. _doxid-group__dnnl__graph__api__op_1gaa4605432c3cd40570607a40a1448e777: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_set_attr_f32( :ref:`dnnl_graph_op_t` op, :ref:`dnnl_graph_op_attr_t` name, const float* value, size_t value_len ) Sets floating point attribute to an op. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - Input op. * - name - The attribute's name. * - value - The attribute's value. * - value_len - The number of value element. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_op_set_attr_bool .. _doxid-group__dnnl__graph__api__op_1ga122b16165d16f9e1b36fa04c4df783de: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_set_attr_bool( :ref:`dnnl_graph_op_t` op, :ref:`dnnl_graph_op_attr_t` name, const uint8_t* value, size_t value_len ) Sets boolean attribute to an op. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - Input op. * - name - The attribute's name. * - value - The attribute's value. * - value_len - The number of value element. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_op_set_attr_s64 .. _doxid-group__dnnl__graph__api__op_1gaca7be5242f3fd61421bcc49365129965: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_set_attr_s64( :ref:`dnnl_graph_op_t` op, :ref:`dnnl_graph_op_attr_t` name, const int64_t* value, size_t value_len ) Sets integer attribute to an op. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - Input op. * - name - The attribute's name. * - value - The attribute's value. * - value_len - The number of value element. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_op_set_attr_str .. _doxid-group__dnnl__graph__api__op_1gae832731052f5072256527a73326a7d43: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_set_attr_str( :ref:`dnnl_graph_op_t` op, :ref:`dnnl_graph_op_attr_t` name, const char* value, size_t value_len ) Sets string attribute to an op. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - Input op. * - name - The attribute's name. * - value - The attribute's value. * - value_len - The length of the string value. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_op_get_id .. _doxid-group__dnnl__graph__api__op_1ga9258f54424d3e9f3e88356982864d1e0: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_get_id( :ref:`const_dnnl_graph_op_t` op, size_t* id ) Returns the unique id of an op. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - Input op. * - id - Output the unique id. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_op_get_kind .. _doxid-group__dnnl__graph__api__op_1ga11559f93efe532d71c0c6284896d8444: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_op_get_kind( :ref:`const_dnnl_graph_op_t` op, :ref:`dnnl_graph_op_kind_t`* kind ) Returns the kind of an op. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - op - Input op. * - kind - Output op kind. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise.