aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorVidhya Sudhan Loganathan <vidhyasudhan.loganathan@arm.com>2018-04-23 08:20:04 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:49:54 +0000
commit3ca9786fe8ed00ad03963cae6a9eef7bb2fe630e (patch)
treebfb90cff9267f9b9259d241f29e3aecaaf3b17b2 /arm_compute
parentbf3c6626e98b9e1be435fce9fdabc9d21f3b5b3a (diff)
downloadComputeLibrary-3ca9786fe8ed00ad03963cae6a9eef7bb2fe630e.tar.gz
COMPMID-718 : Winograd: add validate method and tests
Validate methods added to Winograd kernels and function. Renamed validation test suit Change-Id: I0a88df436aff0bbaf4fd82213eeda089b87ac5bf Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/127781 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/core/Error.h10
-rw-r--r--arm_compute/core/NEON/kernels/NEWinogradLayerKernel.h52
-rw-r--r--arm_compute/runtime/NEON/functions/NEWinogradLayer.h8
3 files changed, 66 insertions, 4 deletions
diff --git a/arm_compute/core/Error.h b/arm_compute/core/Error.h
index 590da9b58e..3635e93244 100644
--- a/arm_compute/core/Error.h
+++ b/arm_compute/core/Error.h
@@ -175,6 +175,16 @@ Status create_error(ErrorCode error_code, const char *function, const char *file
*/
#define ARM_COMPUTE_CREATE_ERROR_LOC(error_code, func, file, line, ...) ::arm_compute::create_error(error_code, func, file, line, __VA_ARGS__) // NOLINT
+/** An error is returned with the given description.
+ *
+ * @param[in] ... Error description message.
+ */
+#define ARM_COMPUTE_RETURN_ERROR_MSG(...) \
+ do \
+ { \
+ return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, __VA_ARGS__); \
+ } while(false)
+
/** Checks if a status contains an error and returns it
*
* @param[in] status Status value to check
diff --git a/arm_compute/core/NEON/kernels/NEWinogradLayerKernel.h b/arm_compute/core/NEON/kernels/NEWinogradLayerKernel.h
index 2f44d19b4f..69d8cc6851 100644
--- a/arm_compute/core/NEON/kernels/NEWinogradLayerKernel.h
+++ b/arm_compute/core/NEON/kernels/NEWinogradLayerKernel.h
@@ -124,7 +124,7 @@ public:
/** Configure the output transform kernel.
*
- * @param[in] input Input tensor data
+ * @param[in] input Input tensor data. Data types supported: F32.
* @param[in] n_batches Number of batches in input tensor.
* @param[in] n_rows Number of rows in input tensor.
* @param[in] n_cols Number of columns in input tensor.
@@ -152,6 +152,17 @@ public:
/** Winograd convolution kernel */
using WinogradConv = typename WinogradBase::template Convolution<T, T>;
+ /** Static function to check if given info will lead to a valid configuration of @ref NEWinogradLayerTransformInputKernel
+ *
+ * @param[in] input First tensor input info. Data types supported: F32.
+ * @param[in] output Output tensor info. Data types supported: same as @p input.
+ * @param[in] conv_info Contains padding and stride information described in @ref PadStrideInfo. Currently only unit strides are supported.
+ * @param[in] kernel_dims Kernel dimensions. Currently only 3x3 and 5x5 kernels are supported
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &conv_info, const Size2D &kernel_dims);
+
private:
using InputTransform = typename WinogradBase::template InputTransform<T>;
std::unique_ptr<InputTransform> _transform;
@@ -301,6 +312,19 @@ public:
void run(const Window &window, const ThreadInfo &info) override;
bool is_parallelisable() const override;
+ /** Static function to check if given info will lead to a valid configuration of @ref NEWinogradLayerTransformOutputKernel
+ *
+ * @param[in] input Source tensor with shape [C, N, 16, batches] or [C, N, 36, batches]. Data types supported: F32.
+ * @param[in] bias Biases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM]. It can be a nullptr. Data type supported: as @p input
+ * @param[out] output Destination tensor with shape [output_convolved_dims.width, output_convolved_dims.height, C, batches]. Data type supported: same as @p input
+ * @param[in] kernel_dims Kernel dimensions (Width and height). Currently only supported 3x3 and 5x5 kernels
+ * @param[in] output_convolved_dims Output dimensions after the convolution (Width and height)
+ * @param[in] num_tiles Number of tiles of size 2x2 or 4x4 in the output tensor along the X and Y direction
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const Size2D &kernel_dims, const Size2D &output_convolved_dims, const Size2D &num_tiles);
+
private:
using WinogradBase = winograd::WinogradGEMM<OutputTileRows, OutputTileCols, KernelRows, KernelCols>;
using WinogradConv = typename WinogradBase::template Convolution<T, T>;
@@ -366,6 +390,17 @@ public:
return "NEWinogradLayerTransformWeightsKernel";
}
+ /** Static function to check if given info will lead to a valid configuration of @ref NEWinogradLayerTransformWeightsKernel
+ *
+ * @param[in] input Source tensor info. The input is a 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM] (NCHW data layout).
+ * kernel_x must be 3 and equal to kernel_y. Data types supported: F32.
+ * @param[in] output Destination tensor info. The output is a 3D tensor with dimensions [OFM, IFM, 16] or [OFM, IFM, 36]. Data type supported: same as @p input
+ * @param[in] output_tile Output tile. Currently only 2x2 and 4x4 tiles are supported.
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output, const Size2D &output_tile);
+
// Inherited methods overridden:
void configure(const ITensor *weights_hwio, T *const output, const int matrix_stride, const int n_output_channels, const int n_input_channels) override;
unsigned int get_weight_storage_size(int n_output_channels, int n_input_channels) const override;
@@ -496,6 +531,21 @@ public:
void run(const Window &window, const ThreadInfo &info) override;
+ /** Static function to check if given info will lead to a valid configuration of @ref NEWinogradLayerBatchedGEMMKernel.
+ *
+ * @param[in] a First input tensor (Matrix or Vector A). Data types supported: F32
+ * @param[in] b Second input tensor (Matrix B). Data type supported: same as @p a.
+ * @param[in] c Third input tensor (Matrix C). It can be a nullptr if just the multiplication between @p a and @p b is needed. Data type supported: same as @p a.
+ * @param[out] output Output tensor. Data type supported: same as @p a
+ * @param[in] alpha Weight of the matrix product
+ * @param[in] beta Weight of matrix C
+ * @param[in] gemm_info (Optional) Specifies if the matrix A and/or matrix B have been reshaped and
+ * if the reshape of matrix B should happen only for the first run
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *a, const ITensorInfo *b, const ITensor *c, const ITensorInfo *output, const float alpha, const float beta, const GEMMInfo &gemm_info = GEMMInfo());
+
private:
static const int _output_tile_rows = OutputTileRows;
static const int _output_tile_cols = OutputTileCols;
diff --git a/arm_compute/runtime/NEON/functions/NEWinogradLayer.h b/arm_compute/runtime/NEON/functions/NEWinogradLayer.h
index 61a4caae3a..27b1e84201 100644
--- a/arm_compute/runtime/NEON/functions/NEWinogradLayer.h
+++ b/arm_compute/runtime/NEON/functions/NEWinogradLayer.h
@@ -57,7 +57,7 @@ public:
* while every optional dimension from 4 and above represent a batch of inputs.
* Data types supported: F32.
* @param[in] weights Weights tensor. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported: Same as @p input.
- * Currently only 3x3 kernels are supported.
+ * Currently only 3x3 and 5x5 kernels are supported.
* @param[in] biases Biases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM]. Data type supported: Same as @p weights.
* @param[out] output Destination tensor. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs.
* Data types supported: Same as @p input.
@@ -75,15 +75,17 @@ public:
* while every optional dimension from 4 and above represent a batch of inputs.
* Data types supported: F32.
* @param[in] weights Weights tensor. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported:Same as @p input.
- * Currently only 3x3 kernels are supported.
+ * Currently only 3x3 and 5x5 kernels are supported.
* @param[in] biases Biases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM]. Data type supported: Same as @p weights.
* @param[in] output Destination tensor. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs.
* Data types supported: Same as @p input.
* @param[in] conv_info Contains padding and stride information described in @ref PadStrideInfo. Currently only unit strides are supported.
+ * @param[in] act_info (Optional) Activation layer information in case of a fused activation.
*
* @return a status
*/
- static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info);
+ static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info,
+ const ActivationLayerInfo &act_info = ActivationLayerInfo());
/** Prevent instances of this class from being copied (As this class contains pointers) */
NEWinogradLayer(const NEWinogradLayer &) = delete;