The OpenVX Specification  dba1aa3
Tensor Matrix Multiply

Detailed Description

Creates a generalized matrix multiplication node.

Performs:

\[ output = T1(input1)*T2(input2)) + T3(input3) \]

Where matrix multiplication is defined as:

\[ C[i*L+j] = saturate(truncate(round(\sum_{k=1}^{M} (C[i*L+j] + ((int)A[i*M+k])*((int)B[k*L+j]))))) \]

where i,j are indexes from 1 to N,L respectively. C matrix is of size NxL. A matrix is of size NxM and B matrix is of size MxL. For signed integers, a fixed point calculation is performed with round, truncate and saturate according to the number of accumulator bits. round: rounding to nearest on the fractional part. truncate: at every multiplication result of 32bit is truncated after rounding. saturate: a saturation if performed on the accumulation and after the truncation, meaning no saturation is performed on the multiplication result.

Data Structures

struct  vx_tensor_matrix_multiply_params_t
 Matrix Multiply Parameters. More...
 

Functions

vx_node VX_API_CALL vxTensorMatrixMultiplyNode (vx_graph graph, vx_tensor input1, vx_tensor input2, vx_tensor input3, const vx_tensor_matrix_multiply_params_t *matrix_multiply_params, vx_tensor output)
 [Graph] Creates a generalized matrix multiplication node. More...
 
vx_status VX_API_CALL vxuTensorMatrixMultiply (vx_context context, vx_tensor input1, vx_tensor input2, vx_tensor input3, const vx_tensor_matrix_multiply_params_t *matrix_multiply_params, vx_tensor output)
 [Immediate] Performs a generalized matrix multiplication. More...
 

Data Structure Documentation

struct vx_tensor_matrix_multiply_params_t

Matrix Multiply Parameters.

transpose_input1/input2/input3 : if True the matrix is transposed before the operation, otherwise the matrix is used as is.

Definition at line 1590 of file vx_types.h.

Data Fields
vx_bool transpose_input1 if True the matrix is transposed before the operation, otherwise the matrix is used as is
vx_bool transpose_input2 if True the matrix is transposed before the operation, otherwise the matrix is used as is
vx_bool transpose_input3 if True the matrix is transposed before the operation, otherwise the matrix is used as is

Function Documentation

vx_node VX_API_CALL vxTensorMatrixMultiplyNode ( vx_graph  graph,
vx_tensor  input1,
vx_tensor  input2,
vx_tensor  input3,
const vx_tensor_matrix_multiply_params_t matrix_multiply_params,
vx_tensor  output 
)

[Graph] Creates a generalized matrix multiplication node.

Parameters
[in]graphThe reference to the graph.
[in]input1The first input 2D tensor of type VX_TYPE_INT16 with fixed_point_pos 8, or tensor data types VX_TYPE_UINT8 or VX_TYPE_INT8, with fixed_point_pos 0.
[in]input2The second 2D tensor. Must be in the same data type as input1.
[in]input3The third 2D tensor. Must be in the same data type as input1. [optional].
[in]matrix_multiply_paramsMatrix multiply parameters, see vx_tensor_matrix_multiply_params_t .
[out]outputThe output 2D tensor. Must be in the same data type as input1. Output dimension must agree the formula in the description.
Returns
vx_node.
A node reference vx_node. Any possible errors preventing a successful creation should be checked using vxGetStatus.
vx_status VX_API_CALL vxuTensorMatrixMultiply ( vx_context  context,
vx_tensor  input1,
vx_tensor  input2,
vx_tensor  input3,
const vx_tensor_matrix_multiply_params_t matrix_multiply_params,
vx_tensor  output 
)

[Immediate] Performs a generalized matrix multiplication.

Parameters
[in]contextThe reference to the overall context.
[in]input1The first input 2D tensor of type VX_TYPE_INT16 with fixed_point_pos 8, or tensor data types VX_TYPE_UINT8 or VX_TYPE_INT8, with fixed_point_pos 0.
[in]input2The second 2D tensor. Must be in the same data type as input1.
[in]input3The third 2D tensor. Must be in the same data type as input1. [optional].
[in]matrix_multiply_paramsMatrix multiply parameters, see vx_tensor_matrix_multiply_params_t .
[out]outputThe output 2D tensor. Must be in the same data type as input1. Output dimension must agree the formula in the description.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSSuccess
*An error occurred. See vx_status_e.