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

Function TEST_CASE

tests/validation/CL/LSTMLayerQuantized.cpp:74–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72TEST_SUITE(IntegrationTestCase)
73TEST_SUITE(MultSmallerEq1)
74TEST_CASE(RunSmall, framework::DatasetMode::PRECOMMIT)
75{
76 const int batch_size = 2;
77 const int input_size = 2;
78 const int output_size = 4;
79
80 QuantizationInfo qasymm(1.f / 128.f, 128);
81 QuantizationInfo qweights(1.f / 128.f, 128);
82 QuantizationInfo qsymm_3(8.f / 32768.f, 0);
83 QuantizationInfo qsymm_4(16.f / 32768.f, 0);
84
85 TensorShape input_shape{ input_size, batch_size };
86 TensorShape input_weights_shape{ input_size, output_size };
87 TensorShape recurrent_weights_shape{ output_size, output_size };
88 TensorShape output_shape{ output_size, batch_size};
89 TensorShape bias_shape{ output_size };
90
91 auto input_to_input_weights = create_tensor<CLTensor>(input_weights_shape, DataType::QASYMM8, 1, qweights);
92 auto input_to_forget_weights = create_tensor<CLTensor>(input_weights_shape, DataType::QASYMM8, 1, qweights);
93 auto input_to_cell_weights = create_tensor<CLTensor>(input_weights_shape, DataType::QASYMM8, 1, qweights);
94 auto input_to_output_weights = create_tensor<CLTensor>(input_weights_shape, DataType::QASYMM8, 1, qweights);
95 auto recurrent_to_input_weights = create_tensor<CLTensor>(recurrent_weights_shape, DataType::QASYMM8, 1, qweights);
96 auto recurrent_to_forget_weights = create_tensor<CLTensor>(recurrent_weights_shape, DataType::QASYMM8, 1, qweights);
97 auto recurrent_to_cell_weights = create_tensor<CLTensor>(recurrent_weights_shape, DataType::QASYMM8, 1, qweights);
98 auto recurrent_to_output_weights = create_tensor<CLTensor>(recurrent_weights_shape, DataType::QASYMM8, 1, qweights);
99 auto input_gate_bias = create_tensor<CLTensor>(bias_shape, DataType::S32);
100 auto forget_gate_bias = create_tensor<CLTensor>(bias_shape, DataType::S32);
101 auto cell_gate_bias = create_tensor<CLTensor>(bias_shape, DataType::S32);
102 auto output_gate_bias = create_tensor<CLTensor>(bias_shape, DataType::S32);
103
104 // LSTM input
105 auto input = create_tensor<CLTensor>(input_shape, DataType::QASYMM8, 1, qasymm);
106
107 // LSTM output state
108 auto output_state = create_tensor<CLTensor>(output_shape, DataType::QASYMM8, 1, qasymm);
109
110 // LSTM cell state
111 auto cell_state = create_tensor<CLTensor>(output_shape, DataType::QSYMM16, 1, qsymm_4);
112
113 CLLSTMLayerQuantized lstmq;
114
115 lstmq.configure(&input, &input_to_input_weights, &input_to_forget_weights, &input_to_cell_weights, &input_to_output_weights,
116 &recurrent_to_input_weights, &recurrent_to_forget_weights, &recurrent_to_cell_weights, &recurrent_to_output_weights,
117 &input_gate_bias, &forget_gate_bias, &cell_gate_bias, &output_gate_bias, &cell_state, &output_state, &cell_state, &output_state);
118
119 input.allocator()->allocate();
120 input_to_input_weights.allocator()->allocate();
121 input_to_forget_weights.allocator()->allocate();
122 input_to_cell_weights.allocator()->allocate();
123 input_to_output_weights.allocator()->allocate();
124 recurrent_to_input_weights.allocator()->allocate();
125 recurrent_to_forget_weights.allocator()->allocate();
126 recurrent_to_cell_weights.allocator()->allocate();
127 recurrent_to_output_weights.allocator()->allocate();
128 input_gate_bias.allocator()->allocate();
129 forget_gate_bias.allocator()->allocate();
130 cell_gate_bias.allocator()->allocate();
131 output_gate_bias.allocator()->allocate();

Callers

nothing calls this directly

Calls 7

CLAccessorClass · 0.85
fill_tensorFunction · 0.70
validateFunction · 0.50
configureMethod · 0.45
allocateMethod · 0.45
allocatorMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected