MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / validate

Method validate

src/gpu/cl/kernels/ClMatMulNativeKernel.cpp:115–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115Status ClMatMulNativeKernel::validate(const ITensorInfo *lhs,
116 const ITensorInfo *rhs,
117 const ITensorInfo *bias,
118 const ITensorInfo *dst,
119 const MatMulKernelInfo &matmul_kernel_info,
120 const ActivationLayerInfo &act_info)
121{
122 ARM_COMPUTE_UNUSED(act_info);
123 ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(lhs, rhs, dst);
124 ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(lhs, rhs);
125 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(lhs, 1, DataType::F32, DataType::F16);
126 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(lhs, rhs);
127 ARM_COMPUTE_RETURN_ON_ERROR(validate_matmul_kernel_info(matmul_kernel_info));
128 ARM_COMPUTE_RETURN_ON_ERROR(
129 validate_matmul_input_shapes(lhs->tensor_shape(), rhs->tensor_shape(), matmul_kernel_info));
130 ARM_COMPUTE_RETURN_ON_ERROR(validate_export_to_cl_image(rhs, matmul_kernel_info));
131
132 const TensorShape expected_output_shape =
133 misc::shape_calculator::compute_matmul_shape(lhs->tensor_shape(), rhs->tensor_shape(), matmul_kernel_info);
134
135 if (dst->total_size() != 0)
136 {
137 ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(dst);
138 const TensorInfo tensor_info_dst = dst->clone()->set_tensor_shape(expected_output_shape);
139 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(dst, &tensor_info_dst);
140 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(lhs, dst);
141 }
142 else
143 {
144 const TensorInfo dst_info(expected_output_shape, lhs->num_channels(), lhs->data_type());
145 ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&dst_info);
146 }
147
148 if (bias != nullptr)
149 {
150 ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(bias);
151 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(bias, lhs);
152 ARM_COMPUTE_RETURN_ERROR_ON_MSG((bias->num_dimensions() > 1), "Multi dimensional bias is unsupported.");
153 ARM_COMPUTE_RETURN_ERROR_ON_MSG(bias->dimension(0) != expected_output_shape[0],
154 "First dimension of bias and output tensors must match.");
155 }
156
157 return Status{};
158}
159void ClMatMulNativeKernel::configure(const ClCompileContext &compile_context,
160 ITensorInfo *lhs,
161 ITensorInfo *rhs,

Callers

nothing calls this directly

Calls 10

compute_matmul_shapeFunction · 0.85
total_sizeMethod · 0.45
cloneMethod · 0.45
num_channelsMethod · 0.45
data_typeMethod · 0.45
num_dimensionsMethod · 0.45
dimensionMethod · 0.45

Tested by

no test coverage detected