diff options
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp')
-rw-r--r-- | src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp b/src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp index a02160cba8..e7ee1c10df 100644 --- a/src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp +++ b/src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp @@ -22,8 +22,8 @@ * SOFTWARE. */ #include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuAdd.h" +#include "arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h" -#include "src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h" #include "src/dynamic_fusion/sketch/gpu/operators/internal/GpuElementwiseBinaryCommon.h" namespace arm_compute @@ -36,9 +36,13 @@ Status GpuAdd::validate_op(const GpuWorkloadSketch &sketch, const ITensorInfo *lhs, const ITensorInfo *rhs) { - // Set the elementwise operation to ADD then call the elementwise common validate_op + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(lhs, rhs); + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(lhs, 1, DataType::F16, DataType::F32, DataType::U8, DataType::S16, DataType::S32); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(lhs->data_type() != rhs->data_type(), "Input tensors must be the same data type"); + + // Set the elementwise operation to Add then call the elementwise common validate_op ElementwiseBinaryCommonAttributes common_attributes{}; - common_attributes.operation(ElementwiseBinaryCommonAttributes::ElementwiseOp::ADD); + common_attributes.operation(ElementwiseBinaryCommonAttributes::ElementwiseOp::Add); return GpuElementwiseBinaryCommon::validate_op(sketch, lhs, rhs, common_attributes); } @@ -46,9 +50,13 @@ Status GpuAdd::is_supported_op(const GpuWorkloadContext &context, const ITensorInfo *lhs, const ITensorInfo *rhs) { - // Set the elementwise operation to ADD then call the elementwise common is_supported_op + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(lhs, rhs); + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(lhs, 1, DataType::F16, DataType::F32, DataType::U8, DataType::S16, DataType::S32); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(lhs->data_type() != rhs->data_type(), "Input tensors must be the same data type"); + + // Set the elementwise operation to Add then call the elementwise common is_supported_op ElementwiseBinaryCommonAttributes common_attributes{}; - common_attributes.operation(ElementwiseBinaryCommonAttributes::ElementwiseOp::ADD); + common_attributes.operation(ElementwiseBinaryCommonAttributes::ElementwiseOp::Add); return GpuElementwiseBinaryCommon::is_supported_op(context, lhs, rhs, common_attributes); } @@ -57,9 +65,9 @@ ITensorInfo *GpuAdd::create_op(GpuWorkloadSketch &sketch, ITensorInfo *rhs) { // No need to log or validate as they'll be handled inside GpuElementwiseBinaryCommon::create_op() - // Set the elementwise operation to ADD then call the elementwise common create_op + // Set the elementwise operation to Add then call the elementwise common create_op ElementwiseBinaryCommonAttributes common_attributes{}; - common_attributes.operation(ElementwiseBinaryCommonAttributes::ElementwiseOp::ADD); + common_attributes.operation(ElementwiseBinaryCommonAttributes::ElementwiseOp::Add); return GpuElementwiseBinaryCommon::create_op(sketch, lhs, rhs, common_attributes); } |