aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreddie Liardet <frederick.liardet@arm.com>2021-10-26 14:06:47 +0100
committerFreddie Liardet <frederick.liardet@arm.com>2021-10-27 12:24:45 +0000
commit69df64fc340215b8ce71d30105eb681811f5e0c3 (patch)
tree1a42c57e905e7d6adceaa9720e2ea039fc79dc45
parentf727ef49e2109bdac105dd6575d2e336adf780a3 (diff)
downloadComputeLibrary-69df64fc340215b8ce71d30105eb681811f5e0c3.tar.gz
Improve conv3d validation
Improve validation of cpu conv3d and add validation test. Align Size3D to Size3D comparison with how Size2D implements it. Remove print statement in MaxUnpooling validation tests. Signed-off-by: Freddie Liardet <frederick.liardet@arm.com> Change-Id: I17048d56b08704cdbf1ad978af02009e57f3aa83 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6512 Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--arm_compute/core/Size3D.h28
-rw-r--r--src/core/Size3D.cpp10
-rw-r--r--src/cpu/kernels/CpuDirectConv3dKernel.cpp8
-rw-r--r--src/gpu/cl/kernels/ClDirectConv3dKernel.cpp1
-rw-r--r--tests/validation/CL/Convolution3D.cpp4
-rw-r--r--tests/validation/CL/MaxUnpoolingLayer.cpp1
-rw-r--r--tests/validation/NEON/Convolution3D.cpp6
7 files changed, 23 insertions, 35 deletions
diff --git a/arm_compute/core/Size3D.h b/arm_compute/core/Size3D.h
index 1d8febe3ce..148bd17919 100644
--- a/arm_compute/core/Size3D.h
+++ b/arm_compute/core/Size3D.h
@@ -78,29 +78,21 @@ public:
return depth;
}
+ bool operator!=(const Size3D &other) const
+ {
+ return !(*this == other);
+ }
+
+ bool operator==(const Size3D &other) const
+ {
+ return (width == other.width) && (height == other.height) && (depth == other.depth);
+ }
+
public:
size_t width = {}; /**< Width of the 3D shape or object */
size_t height = {}; /**< Height of the 3D shape or object */
size_t depth = {}; /**< Depth of the 3D shape or object */
};
-/** Operator to compare two Size3D objects to be equal
- *
- * @param[in] lhs Left-hand side Size3D object.
- * @param[in] rhs Right-hand side Size3D object.
- *
- * @return True if two instances have the same width, height and depth
- */
-bool operator==(const Size3D &lhs, const Size3D &rhs);
-
-/** Operator to compare two Size3D objects to be different
- *
- * @param[in] lhs Left-hand side Size3D object.
- * @param[in] rhs Right-hand side Size3D object.
- *
- * @return True if two instances have a difference in width, height or depth
- */
-bool operator!=(const Size3D &lhs, const Size3D &rhs);
-
} // namespace arm_compute
#endif /* ARM_COMPUTE_SIZE3D_H */
diff --git a/src/core/Size3D.cpp b/src/core/Size3D.cpp
index 4b7850bf38..3ee9fb8e5c 100644
--- a/src/core/Size3D.cpp
+++ b/src/core/Size3D.cpp
@@ -30,14 +30,4 @@ std::string Size3D::to_string() const
{
return support::cpp11::to_string(width) + std::string("x") + support::cpp11::to_string(height) + std::string("x") + support::cpp11::to_string(depth);
}
-
-bool operator!=(const Size3D &lhs, const Size3D &rhs)
-{
- return !(lhs == rhs);
-}
-
-bool operator==(const Size3D &lhs, const Size3D &rhs)
-{
- return (lhs.width == rhs.width) && (lhs.height == rhs.height) && (lhs.depth == rhs.depth);
-}
} \ No newline at end of file
diff --git a/src/cpu/kernels/CpuDirectConv3dKernel.cpp b/src/cpu/kernels/CpuDirectConv3dKernel.cpp
index 4f47787c93..36764a625d 100644
--- a/src/cpu/kernels/CpuDirectConv3dKernel.cpp
+++ b/src/cpu/kernels/CpuDirectConv3dKernel.cpp
@@ -109,14 +109,16 @@ const DirectConv3dKernel *get_implementation(const DirectConv3dSelectorData &dat
Status validate_arguments(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, const Conv3dInfo &conv_info)
{
- const auto *uk = get_implementation(DirectConv3dSelectorData{ src0->data_type(), CPUInfo::get() });
- ARM_COMPUTE_RETURN_ERROR_ON(uk == nullptr || uk->ukernel == nullptr);
-
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src0, src1, dst);
ARM_COMPUTE_RETURN_ERROR_ON(src0->data_layout() != DataLayout::NDHWC);
+ ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(src0, src1, dst);
ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(src0);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(src0, 1, DataType::F16, DataType::F32, DataType::QASYMM8, DataType::QASYMM8_SIGNED);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src0, src1);
+ ARM_COMPUTE_RETURN_ERROR_ON(conv_info.dilation != Size3D(1U, 1U, 1U));
+
+ const auto *uk = get_implementation(DirectConv3dSelectorData{ src0->data_type(), CPUInfo::get() });
+ ARM_COMPUTE_RETURN_ERROR_ON(uk == nullptr || uk->ukernel == nullptr);
const DataLayout data_layout = src0->data_layout();
const int channel_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL);
diff --git a/src/gpu/cl/kernels/ClDirectConv3dKernel.cpp b/src/gpu/cl/kernels/ClDirectConv3dKernel.cpp
index 27afb7e190..a0735b1112 100644
--- a/src/gpu/cl/kernels/ClDirectConv3dKernel.cpp
+++ b/src/gpu/cl/kernels/ClDirectConv3dKernel.cpp
@@ -47,6 +47,7 @@ Status validate_arguments(const ITensorInfo *src0, const ITensorInfo *src1, cons
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(src0);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(src0, 1, DataType::F16, DataType::F32, DataType::QASYMM8, DataType::QASYMM8_SIGNED);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src0, src1);
+ ARM_COMPUTE_RETURN_ERROR_ON(conv3d_info.dilation != Size3D(1U, 1U, 1U));
ARM_COMPUTE_RETURN_ERROR_ON_MSG(src1->dimension(1) != src0->dimension(0), "Weights feature map dimension should match the respective src's one");
ARM_COMPUTE_RETURN_ERROR_ON_MSG(src1->num_dimensions() > 5, "Weights can be at most 5 dimensional");
diff --git a/tests/validation/CL/Convolution3D.cpp b/tests/validation/CL/Convolution3D.cpp
index 2d1dc574f8..9e4ca50547 100644
--- a/tests/validation/CL/Convolution3D.cpp
+++ b/tests/validation/CL/Convolution3D.cpp
@@ -114,7 +114,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zi
framework::dataset::make("SrcDataType", { DataType::F32,
DataType::F32,
DataType::F32,
- DataType::QASYMM8,
+ DataType::U32,
DataType::F32,
DataType::F32,
DataType::F32,
@@ -126,7 +126,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zi
framework::dataset::make("WeightsDataType", { DataType::F32,
DataType::F32,
DataType::F16,
- DataType::QASYMM8,
+ DataType::U32,
DataType::F32,
DataType::F32,
DataType::F32,
diff --git a/tests/validation/CL/MaxUnpoolingLayer.cpp b/tests/validation/CL/MaxUnpoolingLayer.cpp
index a0b20caeae..cf4fcdda70 100644
--- a/tests/validation/CL/MaxUnpoolingLayer.cpp
+++ b/tests/validation/CL/MaxUnpoolingLayer.cpp
@@ -57,7 +57,6 @@ FIXTURE_DATA_TEST_CASE(MaxUnpooling, CLMaxUnpoolingLayerFixture<float>, framewor
))
{
- printf("validate\n");
// Validate output
validate(CLAccessor(_target), _reference);
}
diff --git a/tests/validation/NEON/Convolution3D.cpp b/tests/validation/NEON/Convolution3D.cpp
index 1bfac900c0..4185488742 100644
--- a/tests/validation/NEON/Convolution3D.cpp
+++ b/tests/validation/NEON/Convolution3D.cpp
@@ -87,6 +87,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
TensorInfo(TensorShape(27U, 13U, 2U, 4U), 1U, DataType::F32, DataLayout::NDHWC), // Invalid biases size
TensorInfo(TensorShape(27U, 13U, 2U, 4U), 1U, DataType::F32, DataLayout::NDHWC), // Invalid biases dimensions
TensorInfo(TensorShape(27U, 13U, 2U, 4U), 1U, DataType::F32, DataLayout::NDHWC), // Invalid output size
+ TensorInfo(TensorShape(27U, 13U, 2U, 4U), 1U, DataType::U32, DataLayout::NDHWC), // Invalid data type
}),
framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(4U, 3U, 3U, 3U, 2U), 1U, DataType::F16),
TensorInfo(TensorShape(4U, 3U, 3U, 3U, 3U), 1U, DataType::F32),
@@ -95,6 +96,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
TensorInfo(TensorShape(4U, 3U, 3U, 3U, 2U), 1U, DataType::F32),
TensorInfo(TensorShape(4U, 3U, 3U, 3U, 2U), 1U, DataType::F32),
TensorInfo(TensorShape(4U, 3U, 3U, 3U, 2U), 1U, DataType::F32),
+ TensorInfo(TensorShape(4U, 3U, 3U, 3U, 2U), 1U, DataType::U32),
})),
framework::dataset::make("BiasesInfo",{ TensorInfo(TensorShape(4U), 1U, DataType::F32),
TensorInfo(TensorShape(4U), 1U, DataType::F32),
@@ -103,6 +105,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
TensorInfo(TensorShape(3U), 1U, DataType::F32),
TensorInfo(TensorShape(4U, 2U), 1U, DataType::F32),
TensorInfo(TensorShape(4U), 1U, DataType::F32),
+ TensorInfo(TensorShape(4U), 1U, DataType::F32),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 4U), 1U, DataType::F32),
TensorInfo(TensorShape(25U, 11U, 4U), 1U, DataType::F32),
@@ -111,8 +114,9 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
TensorInfo(TensorShape(25U, 11U, 4U), 1U, DataType::F32),
TensorInfo(TensorShape(25U, 11U, 4U), 1U, DataType::F32),
TensorInfo(TensorShape(26U, 11U, 4U), 1U, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1U, DataType::U32),
})),
- framework::dataset::make("Expected", { false, false, false, false, false, false, false })),
+ framework::dataset::make("Expected", { false, false, false, false, false, false, false, false})),
input_info, weights_info, biases_info, output_info, expected)
{
const Conv3dInfo conv3d_info(Size3D(1, 1, 1), Padding3D(0, 0, 0), ActivationLayerInfo(), Size3D(1U, 1U, 1U), DimensionRoundingType::FLOOR, false);