MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/lite/kernels/basic_rnn_test.cc:258–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256};
257
258TEST(RnnOpTest, BlackBoxTest) {
259 RNNOpModel rnn(2, 16, 8);
260 rnn.SetWeights(rnn_weights);
261 rnn.SetBias(rnn_bias);
262 rnn.SetRecurrentWeights(rnn_recurrent_weights);
263
264 const int input_sequence_size = sizeof(rnn_input) / sizeof(float) /
265 (rnn.input_size() * rnn.num_batches());
266
267 for (int i = 0; i < input_sequence_size; i++) {
268 float* batch_start = rnn_input + i * rnn.input_size();
269 float* batch_end = batch_start + rnn.input_size();
270 rnn.SetInput(0, batch_start, batch_end);
271 rnn.SetInput(rnn.input_size(), batch_start, batch_end);
272
273 rnn.Invoke();
274
275 float* golden_start = rnn_golden_output + i * rnn.num_units();
276 float* golden_end = golden_start + rnn.num_units();
277 std::vector<float> expected;
278 expected.insert(expected.end(), golden_start, golden_end);
279 expected.insert(expected.end(), golden_start, golden_end);
280
281 EXPECT_THAT(rnn.GetOutput(), ElementsAreArray(ArrayFloatNear(expected)));
282 }
283}
284
285TEST(HybridRnnOpTest, BlackBoxTestUint8) {
286 HybridRNNOpModel rnn(2, 16, 8, TensorType_UINT8);

Callers

nothing calls this directly

Calls 12

ArrayFloatNearFunction · 0.70
SetWeightsMethod · 0.45
SetBiasMethod · 0.45
SetRecurrentWeightsMethod · 0.45
input_sizeMethod · 0.45
num_batchesMethod · 0.45
SetInputMethod · 0.45
InvokeMethod · 0.45
num_unitsMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected