Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions include/ideep/operators/matmul.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,10 @@ struct matmul_forward : public dnnl::matmul,

static tensor::desc expected_weights_desc(
const dims& weights_dims,
const dims& src_dims = dims(),
data_type dtype = data_type::f32,
data_type x_dtype = data_type::f32,
const dims& src_dims,
data_type dtype,
data_type x_dtype,
data_type y_dtype,
const attr_t& attr = attr_t(),
const engine& aengine = engine::cpu_engine()) {
auto ndims = weights_dims.size();
Expand All @@ -670,7 +671,6 @@ struct matmul_forward : public dnnl::matmul,
x_dims[ndims-1] = weights_dims[ndims-2];
dims y_dims = (ndims == 3) ? dims({x_dims[0], x_dims[1], weights_dims[2]})
: dims({x_dims[0], weights_dims[1]});
auto y_dtype = (dtype != data_type::s8) ? dtype : data_type::s32;

IDEEP_ENFORCE(x_dims.size() == weights_dims.size(),
"Invalid dims for data and weights");
Expand All @@ -681,6 +681,25 @@ struct matmul_forward : public dnnl::matmul,
return pd.weights_desc();
}

static tensor::desc expected_weights_desc(
const dims& weights_dims,
const dims& src_dims = dims(),
data_type dtype = data_type::f32,
data_type x_dtype = data_type::f32,
const attr_t& attr = attr_t(),
const engine& aengine = engine::cpu_engine()) {
auto y_dtype = (dtype != data_type::s8) ? dtype : data_type::s32;

return expected_weights_desc(
weights_dims,
src_dims,
dtype,
x_dtype,
y_dtype,
attr,
aengine);
}

private:
// For 2-in-1 compute: prepare + compute
// Supports fp32, static int8 and dynamic int8
Expand Down