Matrix Multiplication

Overview

A primitive to perform matrix-matrix multiplication. More…

// structs

struct dnnl_matmul_desc_t;
struct dnnl::matmul;

// global functions

dnnl_status_t DNNL_API dnnl_matmul_desc_init(
    dnnl_matmul_desc_t* matmul_desc,
    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
    );

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_desc_init(
    dnnl_matmul_desc_t* matmul_desc,
    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
    )

Initializes a matrix multiplication descriptor.

Parameters:

matmul_desc

Output descriptor for matmul primitive.

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).

Returns:

dnnl_success on success and a status describing the error otherwise.