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

Function TEST_CASE

tests/validation/NEON/LSTMLayerQuantized.cpp:77–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

AccessorClass · 0.85
fill_tensorFunction · 0.70
validateFunction · 0.50
configureMethod · 0.45
allocateMethod · 0.45
allocatorMethod · 0.45
runMethod · 0.45
populateMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected