From 9593bde92b99fb4473611a2a2bb47a8040bfb500 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Thu, 25 Oct 2018 19:17:35 +0100 Subject: COMPMID-1674: (3RDPARTY_UPDATE) Add FullyConnectedLayer Dragonbench Change-Id: I3c3e96a743614af4c2c2391780d5de2db6191b0f Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/155318 Tested-by: bsgcomp Reviewed-by: Anthony Barbier Reviewed-by: Pablo Tello --- tests/benchmark/fixtures/DragonBenchFixture.h | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'tests/benchmark/fixtures') diff --git a/tests/benchmark/fixtures/DragonBenchFixture.h b/tests/benchmark/fixtures/DragonBenchFixture.h index 526a798154..bb93a46cf5 100644 --- a/tests/benchmark/fixtures/DragonBenchFixture.h +++ b/tests/benchmark/fixtures/DragonBenchFixture.h @@ -113,6 +113,67 @@ private: TensorType dst{}; Function conv_layer{}; }; + +/** Fixture that can be used for NEON and CL */ +template +class DragonBenchFCFixture : public framework::Fixture +{ +public: + template + void setup(FullyConnectedConfig config, DataType data_type, bool has_bias) + { + // Set tensor shapes in NCHW layout + TensorShape src_shape(config.k, config.m); + TensorShape weights_shape(config.k, config.n); + TensorShape biases_shape(config.n); + TensorShape dst_shape(config.n, config.m); + + // Determine bias data type + DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type; + const QuantizationInfo q_info(2.f, 10); + + // Create tensors + src = create_tensor(src_shape, data_type, 1, q_info); + weights = create_tensor(weights_shape, data_type, 1, q_info); + biases = create_tensor(biases_shape, bias_data_type, 1, q_info); + dst = create_tensor(dst_shape, data_type, 1, q_info); + + // Create and configure function + fc_layer.configure(&src, &weights, has_bias ? &biases : nullptr, &dst); + + // Allocate tensors + src.allocator()->allocate(); + weights.allocator()->allocate(); + biases.allocator()->allocate(); + dst.allocator()->allocate(); + } + + void run() + { + fc_layer.run(); + } + + void sync() + { + sync_if_necessary(); + sync_tensor_if_necessary(dst); + } + + void teardown() + { + src.allocator()->free(); + weights.allocator()->free(); + biases.allocator()->free(); + dst.allocator()->free(); + } + +private: + TensorType src{}; + TensorType weights{}; + TensorType biases{}; + TensorType dst{}; + Function fc_layer{}; +}; } // namespace benchmark } // namespace test } // namespace arm_compute -- cgit v1.2.1