Matrix Multiplication

Overview

A primitive to perform matrix-matrix multiplication. More…

// structs

struct dnnl::matmul;

// global functions

dnnl_status_t DNNL_API dnnl_matmul_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    const_dnnl_memory_desc_t src_desc,
    const_dnnl_memory_desc_t weights_desc,
    const_dnnl_memory_desc_t bias_desc,
    const_dnnl_memory_desc_t dst_desc,
    const_dnnl_primitive_attr_t attr
    );

Detailed Documentation

A primitive to perform matrix-matrix multiplication.

The batched mode is supported with 3D tensors.

See also:

Matrix Multiplication in developer guide

Global Functions

dnnl_status_t DNNL_API dnnl_matmul_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    const_dnnl_memory_desc_t src_desc,
    const_dnnl_memory_desc_t weights_desc,
    const_dnnl_memory_desc_t bias_desc,
    const_dnnl_memory_desc_t dst_desc,
    const_dnnl_primitive_attr_t attr
    )

Creates a primitive descriptor for a matrix multiplication primitive.

Parameters:

primitive_desc

Output primitive descriptor.

engine

Engine to use.

src_desc

Source memory descriptor (matrix A)

weights_desc

Weights memory descriptor (matrix B)

bias_desc

Bias memory descriptor. Passing NULL, a zero memory descriptor, or a memory descriptor with format_kind set to dnnl_format_kind_undef disables the bias term.

dst_desc

Destination memory descriptor (matrix C).

attr

Primitive attributes (can be NULL).

Returns:

dnnl_success on success and a status describing the error otherwise.